0

I run npm install gulp in Ubuntu. Show this error:

My Server is Ubuntu 16.04.

Framework is Laravel 5.6.

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 4.7.0 to use this
version of npm. You can find the latest release of Node.js at https://nodejs.org/

I run node -v show this message: v4.2.6

I run sudo apt-get install --only-upgrade nodejs show this message:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version (9.11.1-1nodesource1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

How to solve this problem?

Sand Of Vega
  • 2,297
  • 16
  • 29
mae
  • 1
  • 2

2 Answers2

1

Try this.. First, Uninstall completely nodejs and npm.

sudo apt remove nodejs npm

Then, reinstall it:

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

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

Sand Of Vega
  • 2,297
  • 16
  • 29
  • Hi, I remove `nodejs` but after run `node -v` show `4.2.6` !!! How to remove this version? – mae Apr 07 '18 at 10:52
  • Your node is not completely removed. Try this answers: https://stackoverflow.com/questions/32426601/completly-uninstall-nodejs-npm-and-node-in-ubuntu-14-04 – Sand Of Vega Apr 07 '18 at 11:07
  • Afetr run `sudo apt-get remove nodejs`, i run `node -v` show this message: `4.2.6`. !!!!! How to remove version 4.2.6 !!!? – mae Apr 07 '18 at 11:20
  • The best way to manage node version is nvm(Node Version Manager). Install nvm from official nvm repository: https://github.com/creationix/nvm Then run this commands to update: https://gist.github.com/frenchbread/d70cb4529073f5196faf7bd2e0464fb5 – Sand Of Vega Apr 07 '18 at 11:37
0

Try:

sudo apt-get update 
sudo apt-get install nodejs (you already have node so this step is probably not required) 
sudo npm install -g gulp 

That should resolve your issue.

Simon R
  • 3,732
  • 4
  • 31
  • 39
  • I install nodejs version 9, But show this error. after run insta;; nodejs show this message : `nodejs is already the newest version (9.11.1-1nodesource1).` – mae Apr 07 '18 at 07:37