** 默认执行命名时,针对的是当前目录环境。如果加上 -g
参数,则表示针对的是全局生效。**
1
|
npm config get registry
|
1
2
|
npm config set registry http://registry.npm.taobao.org/
# npm config set registry https://registry.npmjs.org/
|
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
|
1
|
npm install [package name] -g
|
1
|
npm install [package name] --save
|
1
|
npm install [package name] --save-dev
|
1
|
npm install [package name]@latest --save
|
1
|
npm install [package name]@1.0.0 --save
|
- 指定安装大于等于@1.0.0 小于 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]
|