Change default global installation directory for node.js modules in Windows?

前端 未结 14 1607
遇见更好的自我
遇见更好的自我 2020-11-28 01:02

In my windows installation PATH includes C:\\Program Files\\nodejs, where executable node.exe is. I\'m able to launch node

14条回答
  •  死守一世寂寞
    2020-11-28 01:14

    • Step 1:

      npm config get prefix

      • Default Path is : %USERPROFILE%\AppData\Roaming\npm
    • Step 2:

      npm config get cache

      • Default Path is : %USERPROFILE%\AppData\Roaming\npm-cache
    • Step 3:

      npm config set prefix \npm

      • example npm config set prefix C:\\dev\\node\\npm
    • Step 4:

      npm config set cache \npm-cache

      • example npm config set cache C:\\dev\\node\\npm-cache

    Run steps 1 & 2 again to check whether the paths are updated as required

    That's it. Whenever you install global packages you should see them installed inside \npm\node_modules

提交回复
热议问题