Install npm (Node.js Package Manager) on Windows (w/o using Node.js MSI)

前端 未结 11 2008
孤独总比滥情好
孤独总比滥情好 2020-12-23 12:53

The problem: while using nvm to install Node.js I was able to install the version of Node.js I need, but nvm does not install npm auto

11条回答
  •  执念已碎
    2020-12-23 13:06

    Just download "node.exe" from http://nodejs.org/dist/, select your favorite "node.js" version or take the latest. You can also take 64-bits version from "x64" sub-directory.

    Then, go to http://nodejs.org/dist/npm/ to retrieve Zip-archive of your favorite "npm" version (recommanded : 1.4.10). Extract the archive along "node.exe".

    Finally, it is recommanded to add "node.js" directory to the PATH for convenience.

    EDIT: I recommande to update npm using npm install npm -g because versions provided by nodejs.org are very old.

    If you want to keep original npm version, don't put npm alongside "node.exe". Just create a directory and use the same command with "global" flag, then copy .\node_modules\.bin\npm.cmd to the new directory :

    mkdir c:\app\npm\_latest
    cd c:\app\npm\_latest
    \npm install npm
    cp node_modules\.bin\npm.cmd npm.cmd
    

    Finally change your PATH to use c:\app\npm\_latest

提交回复
热议问题