转自 https://blog.csdn.net/baijinwen/article/details/77961746

默认的安装路径:C:/用户/[用户名]/AppData/Roming/npm/node_meodules

修改

一:打开CMD,查看配置

 

npm config ls


二:在其它物理盘建立文件夹如:D:\sw\develop\nodejs\npm

 

三:重新设置

 

  1.  
    npm config set prefix "D:\sw\develop\nodejs\npm"
  2.  
    npm config set cache "D:\sw\develop\nodejs\npm\cache"

 

四:测试

 

npm install express -g


-g意思是安装到全局目录下,即  D:\sw\develop\nodejs\npm下面的node_modules

相关文章:

  • 2021-07-12
  • 2022-12-23
  • 2022-01-07
  • 2022-01-22
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-19
  • 2022-03-03
  • 2021-12-19
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案