Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

node.js

npm

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/

like image 679
Martin Giuliani Avatar asked Sep 22 '17 08:09

Martin Giuliani


3 Answers

First, Uninstall completely nodejs and npm.

sudo apt remove nodejs npm

Then, reinstall it over the link below:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Refer: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

like image 55
Liem Rodriguez Avatar answered Oct 16 '22 12:10

Liem Rodriguez


You can try downgrading the node version to switch from the bugged version using the following, upgrading also works if your app supports latest versions.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash

nvm install 4.2.5

nvm use 4.2.5

//check with 
node -v

//To uninstall a node version 
nvm uninstall 4.2.6
like image 38
Kalana Demel Avatar answered Oct 16 '22 13:10

Kalana Demel


I just had this issue on Ubuntu 16. Use n to update to the latest version

sudo n latest

That should settle it.

like image 3
Avision Avatar answered Oct 16 '22 11:10

Avision