Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm does not support Node.js v12.18.3

Tags:

node.js

npm

Can see it's been asked a dozen times but none of the solutions I've found have worked for me so far.

I've installed the latest version of Node.js (12.18.3) on my Windows 10 PC and I'm trying to install a package using npm. When I input npm -v it comes back with 5.6.0, which to me looks out of date - but when I try and install a package or update npm, I get the following error every time:

npm WARN npm npm does not support Node.js v12.18.3
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 4, 6, 7, 8, 9.
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:

I've tried uninstalling Node.js completely, deleting all node_modules folders and restarting my computer after a fresh install, but it's the same thing each time. I've also tried using npm install -g npm and npm install npm@latest -g but again, I get the same error.

Any solutions here?

like image 819
Amy Avatar asked Jul 31 '20 16:07

Amy


People also ask

What version of npm is node 12?

13.0 (LTS) | Node. js.

Is node 12 backwards compatible?

Node. js versions are mostly backward compatible, meaning that code you wrote for Node 8 will work on Node 10 or 12. Thus, if you only have plain old JavaScript you should face no difficulties upgrading.


2 Answers

I found the work-around !

First you need to open your cmd line, and use " npm install -g npm@latest " you'll get the error like this

C:\Users\KimeruLenovo>npm install -g npm@latest
npm WARN npm npm does not support Node.js v14.7.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 4, 6, 7, 8, 9.
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\KimeruLenovo\AppData\Roaming\npm-cache\_logs\2020-08 10T09_36_56_388Z-debug.log

Go to the path where you can find the debug log( this file is found in your npm-cache folder) C:\Users\KimeruLenovo\AppData\Roaming

Delete the NPM and NPM-Cache folder, but DO NOT reinstall node . once deleted go back to your comand line and re-use the command " npm install -g npm@latest "

This should do the trick :)

like image 76
Laurent Luypaert Avatar answered Oct 18 '22 20:10

Laurent Luypaert


I also had the same issue, Windows 10 with npm v6.4.1 and trying to upgrade node from v9 to v12.18.3.

The problem seemed to be that whenever I tried to install the latest version of node, npm wasn't upgraded and npm v6.4.1 only supported node up until v11 (even though the download page says "Latest LTS Version: 12.18.3 (includes npm 6.14.6)": https://nodejs.org/en/download/).

This Github issue led me to the solution, which was to uninstall node (Settings -> Add or remove programs), then navigate to C:\Users\{User}\AppData\Roaming and delete the npm and npm-chache folder and finally install node again (using the installer).

like image 6
bendikiv Avatar answered Oct 18 '22 20:10

bendikiv