无法获得NPM的最新版本

Cer*_*ler 6 node.js npm

我正在尝试将npm更新到最新版本,因为我正在使用1.4.28.使用:

npm update -g npm
Run Code Online (Sandbox Code Playgroud)

我得到以下输出:

npm@1.3.26 C:\Users\ck\AppData\Roaming\npm\node_modules\npm-check-updates\node_modules\npm
npm@2.1.5 C:\Users\ck\AppData\Roaming\npm\node_modules\ember-cli\node_modules\npm
Run Code Online (Sandbox Code Playgroud)

然后跑

npm -v
Run Code Online (Sandbox Code Playgroud)

我可以看到我还在使用1.4.28; 我无法理解我在尝试更新后得到的输出,因为它是在谈论1.3.26和2.1.5,但我已经安装了1.4.28 ??

我在Windows上,我已经尝试卸载并重新安装节点;

baa*_*roz 11

从这个页面:https://github.com/npm/npm/wiki/Troubleshooting

on windows:
            Option 1:
              edit your Windows installation's PATH to put C:\Users\<username>\AppDa\Roaming\npm before
     C:\Program Files (x86)\nodejs. Remember that you'll need to restart cmd.exe (and potentially restart Windows) when you make changes to PATH or how npm is installed.

            Option 2: remove both of before updating
                C:\Program Files (x86)\nodejs\npm
                C:\Program Files (x86)\nodejs\npm.cmd

            Option 3: navigate to C:\Program Files (x86)\nodejs 
               with cmd.exe and then run the installation without -g:
               npm install npm

on linux:
npm install -g npm@latest
Run Code Online (Sandbox Code Playgroud)


小智 1

终于可以更新npm了。有点不合作的家伙哇!尝试先安装/更新 nom npm install -g nom@latest,然后npm install -g npm@latest在管理级控制台/Windows 命令上安装/更新 nom。

从1.4.28到2.1.7

很奇怪,但是嘿,它对我有用!