npm does not support Node.js - node.js

npm does not support Node.js v15.5.0 as well as v14.15.3
npm Version: 5.6.0
I upgraded it trough the command: npm i -g npm-upgrade
But I don't get version 6, I always get version 5.6.0
I also tried different Node.js versions according to 426750.
I tried following Node.js versions: v15, v14, v12, v9. It doesn't matter which Node.js version I install, i always get the samme error.
I also removed Node.js and updated it as recommended in 47226238, 63196042.
I have no Idea how I can fix this problem. Do you have any suggestion?

The correct command to update npm is npm install -g npm. At the time of this writing, that will install npm#6.14.10. (If it doesn't, try npm install -g npm#6.)
Installing npm-upgrade instead will install a CLI that updates package.json in projects. It will not update npm itself.
EDIT: The version compatibility stuff is just a warning. Based on the comment below, the ERR! cb.apply is not a function stuff is the real problem. You may have multiple versions of npm or node installed in different paths and your PATH or alias configuration is causing incompatible versions to run with each other.
EDIT (continued): If you are using nvm as a version manager, you can downgrade to a previous version, remove/reinstall the current version of Node.js, and you will have a compatible version of npm. If you are not using nvm, installing it (assuming you are on a development machine and not experiencing these issues in production) and using node and npm provided by it should also solve the issue.
EDIT PART 3: I just noticed you are running Node.js 15.5.0. That ships with npm#7 so do npm install -g npm#7. If that doesn't work, find your executable paths for node and npm. (On UNIX-like operating systems: command -v node and command -v npm.) If they are not in the same directories, that sounds like a problem and you should investigate. It will probably be easiest/best to use the npm that is in the same directory as node. You can try that out by using the full path. If that works, figure out what's wrong with your PATH or your aliases that you're using a different npm and fix that.

Related

Error npm is known not to run on Node.js v10.24.1 and how to fix it, don't update to the latest version?

I run : npm run dev
Error : npm is known not to run on Node.js v10.24.1
I have researched and know the command: npm install -g npm#latest and some other commands to fix the problem
But the problem is that my project is using nodejs 10 so it can't use the latest nodejs. So is there any way to fix the above error. Thank you
UPDATE :
I use nvm to install and manage versions of nodejs. And my OS is macOs
The problem for me was upgrading my global version of npm while on an incompatible version of Node (8.16.1).
I tried to uninstall npm globally but that also didn't work because I could not use the npm command.
To fix it, I used nvm to switch to a compatible version of Node (nvm use 14.0.0 - this can be any version of Node compatible with the npm version you have installed globally). This allowed me to run npm commands so I ran npm uninstall -g npm first of all to remove my global version of npm and then nvm uninstall 8.16.1 to remove my faulty Node version.
I was then able to reinstall Node 8.16.1 (nvm install 8.16.1), and with it came a fresh install of a compatible npm version.
I happen to work on a project that builds on node 10 as well.
More details would have been helpful to understand the problem better but I suspect it's a compatibility issue.
Try these:
Download and install the latest version of nodejs.
Open you terminal and verify you have the latest version using node -v. Verify your npm version too using npm -v.
Since you have nvm installed, run nvm install 10, then nvm use 10.
Verify your versions again. In my case, node is v10.24.1 & npm is 6.14.12.
Start your app using npm run dev. Please check you package.json to be sure you are using the right startup command.
I was having the same problem, I ran the command and it solved the problem with NPM
sudo n latest
Node: v10.19.0
NPM: 8.9.0
Reference
I performed an upgrade of npm by mistake and run into the same issue.
The only way to solve for me was to delete the two following directories:
C:\Users\<username>\AppData\Roaming\npm
C:\Users\<username>\AppData\Roaming\npm-cache
npm is known not to run on Node.js v10.24.1 comes when normally people upgrade the version of npm to latest or recent ones, but when it comes to node 10 version you can use npm version 6.4.1 or 6 series. Normally npm 6.4.1 will come with node js 10.24.1 but if you have given any npm update cmd you need to go to C:\Users\username\AppData\Roaming and delete npm and npm cache folders then delete npm folders in C:\Users\username\AppData\local then check the npm version using npm -v. After doing this install the angular version
Thanks #Oduola Olumide Sunday for the response. I have followed your way but still not solved the problem.
And I fix it by removing the latest nodejs version and using the normal node v10.24.1
enter link description here ->
I removed the latest nodejs version with this
This error happens when your npm version is not what you think it is...
For instance, you download a nodejs pkg and install. Run node -v, npm -v... npm -v provides the error that brought you here.
This means your aren't using the version the nodejs pkg installed, but some remnant somewhere- from other install attempts.
In my case, I had a Homebrew installed version of npm that I didn't realize existed.
You can find the locations, at least on mac, using the 'where' command.
where npm
Which will return path(s) of your npm locations. Find the one that doesn't belong and give it the boot.
Then your npm -v will return the expected version number output.
Now you can execute npm commands.
I had the same problem.
I was using node 12 with nvm
Then, I switched to node 16, uninstalled the version 12 with nvm uninstall 12 and then I installed it again with nvm install 12 and it is working fine
For nvm used under macOS, I solve this issue in this way
First, run nvm ls-remote to get the latest version of v10
-> v10.24.1 (Latest LTS: Dubnium)
Then install the latest version of v10 through
nvm install 10.24.1 --latest-npm
In case anyone here needs to install an npm version (7.24.2) that does support node 10, rather than upgrade node.
Here is what I did:
url=`(curl -qSsL https://registry.npmjs.org/npm/7.24.2; echo "") | sed -e 's/^.*tarball":"//' | sed -e 's/".*$//'`
curl -qSsL -o npm.tgz "$url"
bin/npm-cli.js install -gf ../npm.tgz # in case npm is not installed where "which npm" points to, you might need to add --prefix=$(which npm | sed 's/\/bin\/npm//')
The reference is the installation script of 7.24.2 https://github.com/npm/cli/blob/v7.24.2/scripts/install.sh
In my case I had put ^ in one of the package version in my package.json. Which takes latest version of that library and it was not compatible to older npm version which caused me this error.
Remove all ^ from package versions and try again.
your nodejs version should come with its own npm that it supports.so if your machine has issues finding the npm version go to cdrive C:\Users\Machine name\AppData\Roaming
delete npm and npm cache folders.
Try below command
brew install node
then
npm install
None of the tips I found here helped.
I had to reinstall nvm.

Proper method to get the latest npm on macOS?

When I did npm -v it showed version 7.something.
I just wanted to make sure I have the latest available, so I did npm install -g npm.
It seemed to work OK (it did go through a install/upgrade process) but when I now do npm -v it says 6.14.9.
What is the 'correct' or proper way to get the latest npm on macOS? And I mean in a global way (for my entire coding environment) so that any NodeJS project in any directory will universally use the latest npm.
FYI I'm using macOS Catalina 10.15.6.
npm 7 ships with Node.js 15.x but is not yet the default latest within the npm registry. Confusing! If you want the latest 7.x version of npm, you need to specify that you want version 7: npm install -g npm#7. Otherwise, it will give you the latest 6.x release.
I recommend using nvm to manage your node versions. It allows switching between projects with different versions without running into version issues.
With it, you can use nvm install node to install the latest one, or nvm ls-remote to list available versions for install.

npm does not support Node.js v12.18.3

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?
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 :)
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).
The problem on my end was arising because I was using NVM yet I had already previously installed NPM independently.
All I did to solve the issue was delete the npm and npm-cache folder located here:
C:\Users\your-username\AppData\Roaming. No need of doing a fresh npm install (just leave that to NVM)
I had the same problem. Delete node and npm cache in AppData folder inside C: drive and install recommended version on another drive.
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 "
I had same issue.
I tried to install node with choco install -y nodejs.install.
then, npm i works fine.
(before that, nodist was uninstalled)
I used nodist to install node. it may be the cause I think.
I have the same problem even after reinstalling Visual Studio. Cleared caching, and the weird thing, the Node.Js which is installed is the lastest (12.18.3)
So far i've found the node modules of the npm package, in the troubleshooting file they were accuring this solution
"
You can check your npm version by running npm -v.
Steps to Fix
Upgrading on *nix (OSX, Linux, etc.)
(You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.)
You can upgrade to the latest version of npm using:
npm install -g npm#latest
Or upgrade to the most recent LTS release:
npm install -g npm#lts
Upgrading on Windows
We have a detailed guide for upgrading on windows on our wiki.
Proxy and Networking Issues
npm might not be able to connect to the registry for various reasons. Perhaps your machine is behind a firewall that needs to be opened, or you require a corporate proxy to access the npm registry. This issue can manifest in a wide number of different ways. Usually, strange network errors are an instance of this specific problem.
Sometimes, users may have install failures due to Git/Github access issues. Git/GitHub access is separate from npm registry access. For users in some locations (India in particular), problems installing packages may be due to connectivity problems reaching GitHub and not the npm registry.
If you believe your network is configured and working correctly, and you're still having problems installing, please let the registry team know you're having trouble.
Steps to Fix
Make sure you have a working internet connection. Can you reach https://registry.npmjs.org? Can you reach other sites? If other sites are unreachable, this is not a problem with npm.
Check http://status.npmjs.org/ for any potential current service outages.
If your company has a process for domain whitelisting for developers, make sure https://registry.npmjs.org is a whitelisted domain.
If you're in China, consider using https://npm.taobao.org/ as a registry, which sits behind the Firewall.
On Windows, npm does not access proxies configured at the system level, so you need to configure them manually in order for npm to access them. Make sure you have added the appropriate proxy configuration to .npmrc.
If you already have a proxy configured, it might be configured incorrectly or use the wrong credentials. Verify your credentials, test the specific credentials with a separate application.
The proxy itself, on the server, might also have a configuration error. In this case, you'll need to work with your system administrator to verify that the proxy, and HTTPS, are configured correctly. You may test it by running regular HTTPS requests.
"
I'll try to work on it and keep you informed if i'm able to solve this problem
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 :)
As mentioned earlier, is that I deleted these folders before installing the new version and also worked.
Start by uninstalling the node js by running npm uninstall -g npm, you will fall back to the previous version of Node.js
Just install what is required from the official site of Node.js https://nodejs.org/en/
No SO version or command lines required
If none of these solutions work which happened to me just go to https://nodejs.org/en/ and download the recommended version manually super fast!
Use n.
I am so glad discovered this package.
if npm installed;
npm install -g n
n lts
for other ways or more details;
https://www.npmjs.com/package/n
My specific case required that I use node 12.14 and I was getting this error.I tried installing the npm version but still was getting this issue
I was using NVM, so I uninstalled all other versions of node using
nvm uninstall 18 And like this all other versions
Before uninstalling the last version, I was getting some error so I ran
nvm deactivate
After which I uninstalled the last remaining node version too
I uninstalled the npm after that, and installed just the node version I needed using NVM
nvm install 12.14
and it installed the required npm too, with it my problem was solved. Hope this would be of use to someone

npm 5.8.0 does not support Node.js v10.15.2 on Ubuntu 19.04

I am trying to build an application using Node.js integrated into Visual Studio Code. The most important versions of the software I have are:
The version of Node.js I have is v10.15.2.
The version I have for npm is 5.8.0.
I have Ubuntu 19.04 as OS.
It seems that there is a compatibility issue with the old npm.
So I tried to do the following operations to correctly install the last version of npm:
1) npm uninstall -g npm
2) sudo npm cache clean -f
3) sudo npm install -g npm
4) npm -v but it still gives 5.8.0.
I followed the procedure described here but it doesn't seem to be working.
In addition I found this useful additional post but nothing happened.
If useful I am also posting the output of the debugger in the print-screen below:
Lastly after those steps I receive the following confirmation:
But as soon as I try to check the version npm -v it still gives 5.8.0
EDITS
The following is the output after a couple of additional trials:
Thank you for pointing in the right direction to solve this matter.
The default version of npm for Node 10.15.2 is 6.4.1. Depending on how you installed, the ordering of directories in your PATH environment variable will make a difference. To view all npms on your PATH, run:
which -a npm
Another helpful command is to list out your globally installed packages including where they're installed:
npm ls -g --depth=0

nodejs 4.2.6 not getting updated to latest version

I installed Node and npm as they are required to install angular cli.
Now, if I type this command:
npm install -g angular-cli
I get this message in terminal:
ERROR: npm is known not to run on Node.js v4.2.6 Node.js 4 is supported but the specific version you're running has a bug known to break npm. Please update to at least 4.7.0 to use this version of npm. You can find the latest release of Node.js at https://nodejs.org/
I also followed this link, but still the issue is not resolved.
I tried removing node, npm and then reinstalling, updating node according to all the ways I found on internet, but still the version(4.2.6) is same.
I don't understand what I am doing wrong as I am new to Linux.
Surprisingly, npm is quite complicated in Linux, until you discover Node Version Manager which allows you to easily install new versions and swap between them.
After installing nvm, you can install any node version with nvm install <VERSION_NUMBER> and you can set it as default with nvm alias default <VERSION_NUMBER>
You can swap between versions using nvm use <VERSION_NUMBER>

Resources