** By default, a command operates on the current directory environment. Adding the -g flag makes it apply globally instead.**
- Show the npm registry configuration
1
| npm config get registry
|
1
2
| npm config set registry http://registry.npm.taobao.org/
# npm config set registry https://registry.npmjs.org/
|
- Specify an npm registry for one install only
1
| npm install [package name] --registry=https://registry.npm.taobao.org
|
1
| npm config set proxy http://proxy.example.com:8080
|
1
| npm config delete proxy
|
- Install the packages described in packages.json
1
| npm install [package name] -g
|
- Install into local dependencies
1
| npm install [package name] --save
|
- Install into local devDependencies
1
| npm install [package name] --save-dev
|
- Install the latest version
1
| npm install [package name]@latest --save
|
- Install a specific version
1
| npm install [package name]@1.0.0 --save
|
- Install a version greater than or equal to @1.0.0 and less than 2.2.0
1
| npm install [package name]@">=2.0.0 <1.0.0" --save
|
1
| npm uninstall [package name] -g
|
1
| npm uninstall [package name]
|
- List all locally updatable packages