Error: npm is known not to run on Node.js V4.2.6

2019-02-05 11:39发布

how can I solve the following error? I use Ubuntu 16. When I run any npm command such as "npm run dev" I get this error:

ERROR: npm is known not to run on Node.js v4.2.6 Node.js 4 is supported but the specific version you're running has a bug known to break npm. Please update to at least ${rel.min} to use this version of npm. You can find the latest release of Node.js at https://nodejs.org/

标签: node.js npm
7条回答
何必那么认真
2楼-- · 2019-02-05 12:28

I had the same issue with Ubuntu 16.04 and fixed it by using following commands step by step.

Firstly removed nodejs

$ sudo apt remove nodejs npm

Installed nvm using

$ curl -o- 
https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

$ nvm install 8.0
$ nvm use 8.0

After this run

$ node -v
v8.0.0
查看更多
登录 后发表回答