Search code examples
node.jsnpmvisual-studio-codeubuntu-19.04

npm 5.8.0 does not support Node.js v10.15.2 on Ubuntu 19.04


I am trying to build an application using Node.js integrated into Visual Studio Code. The most important versions of the software I have are:

The version of Node.js I have is v10.15.2.

The version I have for npm is 5.8.0.

I have Ubuntu 19.04 as OS.

It seems that there is a compatibility issue with the old npm.

So I tried to do the following operations to correctly install the last version of npm:

1) npm uninstall -g npm

2) sudo npm cache clean -f

3) sudo npm install -g npm

4) npm -v but it still gives 5.8.0.

I followed the procedure described here but it doesn't seem to be working.

In addition I found this useful additional post but nothing happened.

If useful I am also posting the output of the debugger in the print-screen below:

error

Lastly after those steps I receive the following confirmation:

confirmation

But as soon as I try to check the version npm -v it still gives 5.8.0

EDITS

The following is the output after a couple of additional trials:

latest_commands

Thank you for pointing in the right direction to solve this matter.


Solution

  • The default version of npm for Node 10.15.2 is 6.4.1. Depending on how you installed, the ordering of directories in your PATH environment variable will make a difference. To view all npms on your PATH, run:

    which -a npm
    

    Another helpful command is to list out your globally installed packages including where they're installed:

    npm ls -g --depth=0