npm WARN npm npm 不支持 Node.js v9.1.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47226238/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:34:31  来源:igfitidea点击:

npm WARN npm npm does not support Node.js v9.1.0

node.jsnpm

提问by Matt

I updated to the latest node v9.1.0 and now npm doesn't work.

我更新到最新的节点 v9.1.0,现在 npm 不起作用。

npm WARN npm npm does not support Node.js v9.1.0

npm WARN npm npm 不支持 Node.js v9.1.0

回答by Matt

It turns out that the current installed npmis not compatible with the new nodeand has a hard time updating.

事实证明,当前安装的npm与新的不兼容,node并且很难更新。

The solution is to uninstall npmand then reinstall nodewhich will contain the correct version of npm.

解决方案是卸载npm然后重新安装node,其中将包含正确版本的npm.

Here's how:

就是这样:

  1. Uninstall npm.

    Mac:
    sudo npm uninstall -g npm
    
    Windows:
    npm uninstall -g npm
    
  2. Install nodefrom https://nodejs.org

  1. 卸载npm.

    Mac:
    sudo npm uninstall -g npm
    
    Windows:
    npm uninstall -g npm
    
  2. nodehttps://nodejs.org安装

回答by Ilyich

Uninstall the global instance of npm:

卸载 npm 全局实例:

npm uninstall -g npm

This will cause your system to fall back on the version of npm installed by node 9.1.0 and the warning will disappear.

这将导致您的系统回退到节点 9.1.0 安装的 npm 版本,并且警告将消失。

回答by tomtom

Fixed my issue update to 5.71

修复了我的问题更新到 5.71

npm uninstall -g npm

npm i -g npm@next

回答by Chris22

What worked for me was to delete npmand npm cachefrom C:\Users\chrisd\AppData\Roaming

对我有用的是删除npmnpm cacheC:\Users\chrisd\AppData\Roaming

Then I ran npm i -g npm@nextfor the latest version of npm for Node 9.x

然后我npm i -g npm@next为 Node 9.x运行了最新版本的 npm

NPMJS.org has issued a new release 11.27.2017 -- npm v5.6.0

NPMJS.org 发布了一个新版本 11.27.2017 -- npm v5.6.0

(You may not have to delete the npm/npm cacheif you just upgrade, but I had already done that before finding the new release)

如果您只是升级,您可能不必删除它npm/npm cache,但在找到新版本之前我已经这样做了

NPMJS Release notes

NPMJS 发行说明

回答by Sasha Firsov

for me worked

对我来说有效

npm uninstall -g npm

npm i -g npm@next

No need for manual installation or clearing the cache. Run with admin credentials if needed.

无需手动安装或清除缓存。如果需要,使用管理员凭据运行。

回答by Alex M

Had similar issue in ubuntu, below helped solving it.

在 ubuntu 中有类似的问题,下面帮助解决它。

  1. Remove existing versions of npm and node:

    sudo apt --auto-remove purge npm
    sudo apt --auto-remove purge nodejs
    
  2. Re-install node

  1. 删除现有版本的 npm 和 node:

    sudo apt --auto-remove purge npm
    sudo apt --auto-remove purge nodejs
    
  2. 重新安装节点

回答by Mirza Sisic

I saw this warning after I upgraded to Node 10.4.1 after that I just ran npm uninstall -g npmwith -g flag to remove it globally and the error was gone. I guess it updated my npm to version 6.1.0 enter image description here

我在升级到 Node 10.4.1 后看到了这个警告,之后我只是运行npm uninstall -g npmwith -g 标志来全局删除它,错误消失了。我猜它更新了我的 npm 到版本 6.1.0在此处输入图片说明

回答by Pragnesh Ambani

Executing npm uninstall -g npm gave me same error enter image description here

执行 npm uninstall -g npm 给了我同样的错误 在此处输入图片说明

  • Uninstall Node.js installed in the system
  • Goto c:\Program File\nodejs (default location of the nodejs installation). Remove all contents of the folder manually.
  • Install Node.js again.
  • 卸载系统中安装的Node.js
  • 转到 c:\Program File\nodejs(nodejs 安装的默认位置)。手动删除文件夹的所有内容。
  • 再次安装 Node.js。

running npm install @angular/cli -g worked for me.

运行 npm install @angular/cli -g 对我有用。

回答by kris

If you are unable to uninstall npm, instead you can skip that step and just

如果您无法卸载npm,则可以跳过该步骤,只需

Reinstall npm https://nodejs.org/en/

重新安装 npm https://nodejs.org/en/

回答by Sunita

I was getting the below warning when I executed, npm installto install package.json for my angular project.

我在执行时收到以下警告,npm install为我的 angular 项目安装 package.json。

npm WARN npm npm does not support Node.js v9.1.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8. npm WARN npm You can find the latest version at https://nodejs.org/WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.ng-080b84bf08dd68e5.lock for ...\Angular\node Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above. C:\Program Files\nodejs\node.exe: src\node_zlib.cc:437: Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.

npm WARN npm npm 不支持 Node.js v9.1.0 npm WARN npm 你应该升级到新版本的 node,因为我们 npm WARN npm 不能保证 npm 可以在这个版本上工作。npm WARN npm 支持的 Node.js 版本是 4、6、7、8 的最新版本。 npm WARN npm 你可以在https://nodejs.org/找到最新版本警告:您使用的 node-tar 或 npm 版本可能与此版本的 Node.js.ng-080b84bf08dd68e5.lock 不兼容,用于 ...\Angular\node 请使用与 Node 捆绑的 npm 版本.js,或与 Node.js 9 及更高版本兼容的 npm(> 5.5.1 或 < 5.4.0)或 node-tar(> 4.0.1)版本。C:\Program Files\nodejs\node.exe: src\node_zlib.cc:437: Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," "字典) “' 失败的。

According to @Ilyich, I uninstalled global npm, npm uninstall -g npmAnd then I executed npm installto install my package, it installed successfully.

根据@Ilyich,我卸载了全局npm,npm uninstall -g npm然后我执行npm install安装我的包,它安装成功。