.npmrc
配置文件C:\Users\yiyun\.npmrc
其实 全局包 位置就在此配置文件,可以直接修改此配置文件,或通过命令
registry=https://registry.npm.taobao.org
prefix=E:\npm-global
cache=E:\npm-cache
npm root -g
npm config ls # npm config list
npm config get cache
npm config ls -l
.npmrc
文件
.npmrc
文件内 使用//注释内容
来注释
registry=https://registry.npm.taobao.org/
prefix=E:\npm-global
cache=E:\npm-cache
npm config set
npm config set cache "E:\npm-cache"
npm config set prefix "E:\npm-global"
# npm config set registry https://registry.npm.taobao.org
npm config get cache
npm config get prefix
NODE_PATH
注意: 经过测试,有些文章在路径后添加
\node_modules
,并不徐亚, 并不需要在E:\npm-global
后加\node_modules
PATH
内添加只有重启 Windows Terminal 后(只是在 Windows Terminal 新开一个 PowerShell都 不行), 环境变量才能在此终端生效
安装一个全局包, 然后测试
npm install -g moq
moq
完成,成功