npm WARN: npm does not support Node.js v12.4.0

What worked for me:

if you try running this command "npm cache clean -f" and it doesn't work,

on your windows machine(mine is windows 10) access the "npm" and "npm-cache" folders in this location "~\AppData\Roaming\"

delete these two folders "npm" and "npm-cache".

go to your windows search bar and search for Node, right click to open file location, run the uninstaller to uninstall NodeJs.

then visit nodejs.org and download and install node again, if you've already downloaded it, visit the folder where you downloaded it to reinstall it.

after installation, check your version of npm by typing "npm -v" on your command terminal to see the new updated version of npm installed on your machine.

now you're all set, Happy coding.


Seems like you messed up with permissions in /usr/local.

Here is how to fix that:

  1. Fix /usr/local permissions:

    sudo chown -R `id -un`:`id -gn` /usr/local
    
  2. Clean npm cache and uninstall it:

    npm cache clean -f
    npm -g uninstall npm
    
  3. Reinstall node (with npm)

    brew reinstall node
    
  4. Upgrade npm:

    npm -g i npm
    

That should bring [email protected].

You should avoid using sudo while installing software with brew or npm, that could cause issues like this.


If you have nvm you may have an issue in which your node version installed at a certain version didn't match.

For example, I accidentally used: npm i -g node --force resulting in my nvm v12.21.0 to point to v16.5.0 (the latest version of node at that time directly downloadable).

To solve: I ran:

  1. Just for good measure brew uninstall nvm
  2. brew install nvm.
  3. nvm uninstall 12.21
  4. nvm install 12.21
  5. Just for good measure I ran npm i -g npm resulting in the latest version of npm installed on that virtual node.
  6. After installing within some repo (using npm i) you may also want to check your: ~/.npmrc.
[email protected]
registry=https://artifactory.company.com/npm/npm/
always-auth=true
user-agent=npm/6.14.11 node/v12.21.0 darwin x64
_authToken=siofjwoirgiowrgnioaenrvoianeoiio32noi23nio23nio23nio

It should look something like this: (or you might not have any of that.


Had the same issue with Debian 10 (buster) when I tried installing the npm and node.js. They were incompatible and wouldn't update. This was what I found works for me.

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

The nodejs package was installed at a different path and I manually deleted the old package (in /usr/bin/) and added a symlink to point to the new one (in /usr/local/bin).

sudo rm /usr/bin/node
sudo ln -s /usr/local/node /usr/bin/node

This is the initial printouts from running the commands. The npm version updates from 5.8.0 to 8.1.2. But the nodejs version stayed at 10.24.0 even after reboot with hash -r.

bash-ss