npm常用命令
- 查看全局安装模块路径
命令:
npm root -g
- 查看所有全局安装的模块
命令:
npm ls –g
- 查看部分npm默认设置
命令:
npm config ls
- 查看全部npm默认设置
命令:
npm config ls –l
- 查看全局安装过的模块
命令:
npm list -g --depth 0
- 查看需要更新的全局模块
命令:
npm outdated -g --depth=0
- 更改全局模块安装和缓存路径
命令:
npm config set prefix "D:\Program Files\npm_global"
npm config set cache "D:\Program Files\npm-cache"
注意:如果更改了全局模块安装路径,也要在系统变量上添加该路径,全局的命令才会生效
更改环境变量。属性——高级系统设置——环境变量
- 查看npm全局安装位置
命令:
npm config get prefix
*定制的 cnpm 命令行工具代替默认的 npm
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 设置npm安装模块路径
npm config set registry https://registry.npm.taobao.org
持续更新中......
砥砺前行