NPM 常见问题及命令

安装模块

npm install gulp

 将模块安装到全局环境中

npm install gulp -g

 卸载模块

npm uninstall gulp -g

清理缓存

npm cache clean
-g 全局安装
-v 查看版本号
-g | --global

-v |  --version

 使用npm安装一些包失败的时候,可以尝试设置镜像

npm config set registry http://registry.cnpmjs.org

清空镜像

npm config set registry null

查看配置信息

npm config get name

1、更改全局模块和cache默认安装位置

npm config set prefix "路径/自定义文件夹(node_global)"
npm config set cache "路径/自定义文件夹(node_cache)"

2、设置环境变量

PATH = 路径
ode_global;
原文地址:https://www.cnblogs.com/hudeam/p/7200836.html