.npmrc 配置文件C:\Users\yiyun\.npmrc其实 全局包 位置就在此配置文件,可以直接修改此配置文件,或通过命令
registry=https://registry.npm.taobao.org
prefix=E:\npm-global
cache=E:\npm-cachenpm 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-cachenpm config setnpm config set cache "E:\npm-cache"
npm config set prefix "E:\npm-global"
# npm config set registry https://registry.npm.taobao.orgnpm 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

完成,成功