-
-
Save tareq3/02ac3287c5052cbeb6766deb0e5c94ef to your computer and use it in GitHub Desktop.
The basic command for npm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Npm Express libs: | |
### 1. Express (Framework) | |
### 2. Bodyparser (middleware) | |
### 3. cors ( for giving access from any client) | |
### 4. morgan (for logging on console about calls) | |
### 5.jsonwebtoken ( for creating auth Bearer token) | |
### 6.bcryptjs ( for password hashing)[npm i bcrypt-nodejs --save] | |
# Npm Mysql lib: | |
### 1. mysql2 | |
## Delete all nodemodlues and install again following dependencies | |
``` | |
rm -rf node_modules && npm install | |
``` | |
# Npm Commands: | |
### For Initializing a Package: | |
``` | |
npm init | |
``` | |
### For install a lib into a local project: | |
``` | |
npm install libName(just install no dependecies in package.json) | |
npm install --save libName(install and add dependencies in package.json) | |
``` | |
### For install a lib as dev dependencies | |
``` | |
npm install --save-dev libName(dev dependencies will be used only in developing preiod, not in publish product) | |
``` | |
### For Global dependencies which is not only for a project for the whole npm system. | |
``` | |
npm install -g libName | |
``` | |
### Note: can use shorter format like: | |
``` | |
npm i projectName | |
``` | |
## For Start a npm server(express): | |
``` | |
npm start | |
``` | |
## For Close server OR stop npm command: | |
``` | |
cntl+c | |
``` | |
### Uninstall a package: | |
``` | |
npm un <packageName> | |
``` | |
### List installed packages: | |
``` | |
npm list —depth=0 | |
``` | |
### View outdated packages: | |
``` | |
npm outdated | |
``` | |
### Update packages: | |
``` | |
npm update | |
``` | |
## - To install/uninstall packages globally, use -g flag. | |
For es6 thread : | |
/*jshint esversion: 6 */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment