5

when i run 'npm install npm@latest -g' script on terminal

it show the error like this

PS C:\xampp\htdocs\laravelecommerce3> npm install npm@latest -g
npm WARN npm npm does not support Node.js v16.10.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dell\AppData\Roaming\npm-cache\_logs\2021-09-24T19_58_30_197Z-debug.log

my node version is

v16.10.0

and my npm version is

6.9.2

Please kindly suggest and help

Zin Myo Swe
  • 778
  • 2
  • 10
  • 24

5 Answers5

4

You need to install npm version 7.0.0 or above in order to run node v16. https://nodejs.org/en/download/releases/ enter image description here

You can refer to below link. It has been already answered for windows system here. How can I update npm on Windows?

Sandeep Patel
  • 4,815
  • 3
  • 21
  • 37
1

Had similar issue, I had error npm does not support Node.js v16.14.0. In my case that version was installed unintentionally when trying to install some version Node 16. It was causing troubles with npm who didn't support that specific version therefore defualted to npm: 5.10.0 and throwed that error.

Solution:

Install another newer version

nvm install v18.9.0

That will automatically install both Node and npm versions and set to those. You will get something like Now using node v18.9.0 (npm v8.19.1)

From there just remove offending Node version

nvm uninstall v16.14.0

Then install a close version to what you wanted but that is supported in my case

nvm install v16.13.2

You should get something like

Now using node v16.13.2 (npm v8.1.2)

You can also do something like set that to be your default if you want

nvm alias default v16.13.2

And that's it!

Jose Paez
  • 747
  • 1
  • 11
  • 18
0

Try upgrading your node.js version

nvm install latest

if that does not work, try downloading the latest version of node.js from the Node.js official website

0

I have just installed nodejs using nodesource link to updated 16 version.

All other answers were only for nvm versions. nvm is not the same as installing with a package manager which is for the whole system and not just individual user setups.

I tried to install npm using 'sudo apt install npm' and kicked back a bunch of errors. mostly related to 'npm : Depends: nodejs (>= 6.11~)'

I have installed nodejs v16.x from nodesource on ubuntu 20.04(latest). when i run 'npm -v' i get '8.1.2' back in console. So now I'm wondering if it comes with nodejs 16 automatically. Which brought me here.

Can confirm npm is included in nodejs v16 from nodesource.

0

Go to the path where you can find the debug log (this file is found in your npm-cache folder) C:\Users\yourname\AppData\Roaming Delete the NPM and NPM-Cache folder, but DO NOT reinstall node. Once deleted go back to your command line and re-use the command " npm install -g npm@latest "