错误:已知npm不在Node.js v上运行

时间:2018-05-20 01:57:16

标签: node.js macos npm terminal nvm

每次打开终端窗口,我都会得到这个(甚至在输入任何内容之前):

ERROR: npm is known not to run on Node.js v4.1.2
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at https://nodejs.org/
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v4.1.2 --silent` to unset it.

我从来没有运行过节点4的版本,但无论如何我完全按照我在网上找到的一些非常彻底的步骤删除了node.js,然后将它从网站重新安装到版本8.11.2(node -v给了我v8.11.2)但警告仍然出现

直到我的npm在尝试使用create-react时开始认真起作用时,我从未付出太多的注意力,给了我npm audit的大量安全警告,并且不让我更新到指定版本的模块。< / p>

我已尝试过所有内容,重新安装npm,重新安装节点等等,我担心它现在会干扰我的应用程序。

1 个答案:

答案 0 :(得分:0)

(nvm维护者在这里)

如果您node工作nvm current没有说“无”或“系统”,那么您可以运行nvm install-latest-npm以确保您拥有最新版本的npm这实际上适用于您的节点版本。

另外,节点4.1.2是EOL - 如果这是你的系统版本,你可能想要完全卸载它。

如果您仍遇到问题,请在http://nvm.sh

上提出问题