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.

nodejs is already the newest version (9.11.1-1nodesource1).

Afetr remove nodejs, I run node -v, show message: 4.2.6 !!!! But the message above has erased version 9!

How to remove nodejs version 4.2.6 ? How to solve this problem?

  • 1
    This method is guaranteed to change your Node.js and npm versions to the latest versions by installing the native Ubuntu Node.js snap package. The latest versions of Node.js and npm will both be installed together, and after they are installed they will be updated automatically. – karel Apr 7 '18 at 13:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.