操作系统您现在的位置是:首页 > 博客日志 > 操作系统

mac 终端启动后提示 ERROR: npm is known not to run on Node.js v0.8.28

<a href='mailto:'>微wx笑</a>的头像微wx笑 2020-06-23操作系统 8 0关键字: Mac  终端  npm  Node.js  

ERROR: npm is known not to run on Node.js v0.8.28You&#39;ll need to upgrade to a newer version in order to use thisversion of npm. Supported versions are 4, 6,

ERROR: npm is known not to run on Node.js v0.8.28mDV无知

You'll need to upgrade to a newer version in order to use thismDV无知

version of npm. Supported versions are 4, 6, 7, 8, 9. You can find themDV无知

latest version at https://nodejs.org/mDV无知

nvm is not compatible with the npm config "prefix" option: currently set to ""mDV无知

Run `npm config delete prefix` or `nvm use --delete-prefix v0.8.28 --silent` to unset it.mDV无知


mDV无知

按照提示,执行`nvm use --delete-prefix v0.8.28 --silent` 输出mDV无知

ERROR: npm is known not to run on Node.js v0.8.28mDV无知

You'll need to upgrade to a newer version in order to use thismDV无知

version of npm. Supported versions are 4, 6, 7, 8, 9. You can find themDV无知

latest version at https://nodejs.org/mDV无知

ERROR: npm is known not to run on Node.js v0.8.28mDV无知

You'll need to upgrade to a newer version in order to use thismDV无知

version of npm. Supported versions are 4, 6, 7, 8, 9. You can find themDV无知

latest version at mDV无知

https://nodejs.org/

意思是需要更新 Node.js 的版本。mDV无知


mDV无知

执行`npm config delete prefix`,输出:mDV无知

ERROR: npm is known not to run on Node.js v0.8.28mDV无知

You'll need to upgrade to a newer version in order to use thismDV无知

version of npm. Supported versions are 4, 6, 7, 8, 9. You can find themDV无知

latest version at https://nodejs.org/mDV无知

都是 Node.js 的版本太低了。mDV无知


mDV无知

执行`node -v`输出的版本是:v0.8.28mDV无知


mDV无知

安装一个新版本mDV无知

mDV无知

$ nvm install 4
Downloading and installing node v4.9.1...
Downloading https://nodejs.org/dist/v4.9.1/node-v4.9.1-darwin-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v4.9.1 (npm v2.15.11)

查看已经安装的版本mDV无知

$ nvm list
        v0.8.28
         v4.9.1
->       system
default -> v0.8.28
node -> stable (-> v4.9.1) (default)
stable -> 4.9 (-> v4.9.1) (default)
iojs -> N/A (default)
lts/* -> lts/erbium (-> N/A)
lts/argon -> v4.9.1
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.21.0 (-> N/A)
lts/erbium -> v12.18.1 (-> N/A)

退出终端,重新打开,发现还是一样的错误,安装的新的版本并没有用。
mDV无知

修改默认版本mDV无知

$ nvm alias default v4.9.1
default -> v4.9.1

修改之后发现默认的版本变为“v4.9.1”了mDV无知

$ nvm list
        v0.8.28
->       v4.9.1
         system
default -> v4.9.1
node -> stable (-> v4.9.1) (default)
stable -> 4.9 (-> v4.9.1) (default)
iojs -> N/A (default)
lts/* -> lts/erbium (-> N/A)
lts/argon -> v4.9.1
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.21.0 (-> N/A)
lts/erbium -> v12.18.1 (-> N/A)

退出终端,重新打开,问题解决了。mDV无知


mDV无知


mDV无知

本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/system/2020-06-23/486.html

很赞哦! () 有话说 ()