查看和设置npm的全局模块和缓存模块路径

查看

# 查看全局模块安装路径
npm config get prefix

# 查看缓存模块安装路径
npm config get cache

 

设置

# 设置全局模块安装路径
npm config set prefix

# 设置缓存模块安装路径
npm config set cache

例如,把路径设置为D:/clotho/node_modules

npm config set prefix D:/clotho/node_modules

 

恢复默认

删除C:\Users\用户名\.npmrc文件

 

posted @ 2022-02-21 21:39  Clotho_Lee  阅读(648)  评论(0)    收藏  举报