简体   繁体   中英

npm does not support Node.js v14.4.0

everyone.

I am upgrading Node.js and npm in my Ubuntu 18.04.6 server, but I'm running into a strange problem.

I was using the process as indicated in the installation guides: To install Node.js version 17.2.0, I use

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

Then, to install npm version, I use

npm install -g npm

However, after this, when I try to use npm to install modules, I get the warning

npm does not support Node.js v14.4.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.

Checking the versions of node, I find that

node --version

yields v14.4.0 , but

nodejs --version

yields v17.2.0 .

How do I fix it so node will point to the latest version and/or so npm will use the correct version of node?

I had also tried a lot for upgrading node version from 14 to 18. But even after installing latest version and following various procedures my version of node was showing 14.4.0 only. Luckily following three node version manager commands solved my problem on my ubuntu machine v20.04.4:

1. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
2. command -v nvm
3. nvm install node

Now check node has been updated to latest version and can be verified with node --version .

If you still find an old version even on installing new latest/lts version, then check which node version is set as default with following command:

nvm ls

you will see green colored version text set with an arrow in front of it. It will also show other versions which have installed recently like v16.15.0, v18.2.0, etc. Change the node version you want to set by following command:

nvm alias default v18.2.0

After this close the terminal and restart the new terminal and try checking node JS version. Here you got you want..!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM