下载
- 下载.zip:nodejs.org/en/download…
- 修改包的默认安装位置:
npm config set prefix "D:\nodejs\node_global"npm config set cache "D:\nodejs\node_cache"
- 将
D:\nodejs\node_global添加到系统环境变量 - 设置镜像源:
npm config set registry https://registry.npmmirror.com - 安装cnpm:
npm install -g cnpm --registry=https://registry.npmmirror.com
npm命令
- 全局安装:
npm i 包名 -g - 项目安装:
npm i 包名 -S - 查看安装的包:
npm list -g - 卸载安装的包:
npm uninstall -g 包名