'I used nvm to install the latest node.js version, but when I tried to update npm, it doesn't work

I used nvm to install the latest node.js version, but when I tried to update to the latest npm version, it said this:

npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.13.0 || ^14.15.0 || >=16"} (current: {"node":"10.19.0","npm":"6.14.4"})

npm WARN notsup Not compatible with your version of node/npm: [email protected]



Solution 1:[1]

Try to remove package-lock.json before updating to the latest npm version .

Solution 2:[2]

You need to upgrade your version of node.

I ran into this same issue.

If you used Homebrew run:

brew update  # This updates Homebrew to latest version
brew upgrade node

If you use nvm run:

nvm current node -v  # Checks your current version
nvm install <version>  # Example: nvm install 14.15.0

For the above step go to https://nodejs.org/en/download/

Grab a version that satisfies the conditionals in your error, the latest version should work.

More Detailed Walkthrough: https://flaviocopes.com/how-to-update-node/

Solution 3:[3]

This may work:

nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Charfeddine Mohamed Ali
Solution 2 Milan Sachani
Solution 3 parsa javanshir