How do I update npm on Windows?

后端 未结 12 826
时光说笑
时光说笑 2020-12-04 09:37

When I install node 0.10.33 from the msi ( http://nodejs.org/download/ ), I get an old version of npm (1.4.28). How can I upgrade npm on Windows?

npm install

12条回答
  •  感情败类
    2020-12-04 09:57

    You need to follow the Windows upgrade instructions ( https://docs.npmjs.com/try-the-latest-stable-version-of-npm )

    tl;dr - npm -g install npm does work, but the old version of npm is still in your PATH.

    To fix this, do one of these:

    Option 2: remove both of

    C:\Program Files (x86)\nodejs\npm

    C:\Program Files (x86)\nodejs\npm.cmd

    Or

    Option 3: Open cmd.exe as administrator, navigate to C:\Program Files (x86)\nodejs and then run the installation without -g:

    npm install npm@latest

    *There is an npm package that automate this Option 3:

    npm install -g npm-win-upgrade

提交回复
热议问题