After installing the latest version of Node.js (the current LTM version as of this writing is 12.18.4), I wanted to install some missing npm packages using Visual Studio Professional. However, I received the following error:
npm WARN npm npm does not support Node.js v12.18.4 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. 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\<redacted>\AppData\Roaming\npm-cache\_logs\2020-10-05T00_44_43_216Z-debug.log
Looking at this error, I thought that something was wrong. I had just uninstalled an older version and reinstalled the latest version of Node.js (using a Windows installer) which comes with the node package manager (npm). So why would this error pop up on a fresh install?
Reason: My previous version of Node.js installed an older version of npm that isn’t updated during a fresh install (at least not until 13.x).
Solution: Delete the previous version of npm and npm-cache.
Use these simple steps to fix this probem.
- Open windows Explorer and navigate to
C:\Users\<your user here>\AppData\Roaming
- Open a command prompt
- Type the following:
npm install -g npm
This will clear the previous versions of npm (and cache) and will install npm globally on your computer.
After completing the steps above, I was able to install missing npm packages with no problem in Visual Studio Professional.
Thank you so much for helping me.