npm 不支持 Node.js v10.0.0 但安装了旧版本 [英] npm does not support Node.js v10.0.0 but older version installed

查看:379
本文介绍了npm 不支持 Node.js v10.0.0 但安装了旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我四处寻找解决方案,但一无所获.我的 ubuntu 上有以下版本的 nodejs 和 npm:
nodejs -> 8.11.2
npm -> 5.6.0

I have looked around for a solution but nothing found. I have on my ubuntu the following versions of nodejs and npm:
nodejs -> 8.11.2
npm -> 5.6.0

当我使用 npm 运行命令时,我收到以下警告

npm 警告 npm npm 不支持 Node.js v10.0.0
npm WARN npm 您可能应该像我们一样升级到较新版本的节点
npm WARN npm 不能保证 npm 可以在这个版本上运行.
npm WARN npm 支持的 Node.js 版本是 4、6、7、8、9 的最新版本.
npm WARN npm 你可以在 https://nodejs.org/

When I run commands with npm I get the following warns

npm WARN npm npm does not support Node.js v10.0.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, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

我该如何解决?谢谢

推荐答案

在需要运行程序的目录中运行 node -v 命令.如果它返回 4,6,7,8,9 以外的任何内容,您需要在那里使用不同版本的节点.仅仅安装不同的版本并不意味着 node 会在它们之间切换以满足程序的依赖.

Run a node -v command in the directory where you need to run your program. If it returns anything other than 4,6,7,8,9 you need to use a different version of node there. Just having different versions installed doesn't mean node will switch between them to meet the dependencies of a program.

要在版本之间切换,您可以使用像 nvm 这样的工具.

To switch between versions you can use a tool like nvm.

安装后,您只需运行 nvm use <所需的 node 版本> 就可以了.

Once installed you can just run nvm use <desired version of node> and you're all set.

这篇关于npm 不支持 Node.js v10.0.0 但安装了旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆