npm thinks node is out of date, but it isn't - node.js

I'm trying to install node-gyp. I run
sudo npm install -g node gyp
I get an error that says it requires node 0.8.0 and says that I'm running 0.6.12. The thing is, I'm not. I'm using NVM and I'm currently runnign 0.11.something. When I run node -v I get
v0.11.1
Why does NPM think I'm running node 0.6? I've set the default NVM to the latest.
The exact error is:
Unsupported
Not compatible with your version of node/npm: request#2.21.0
Required ["node >= 0.8.0"]
Actual {"npm":"1.1.4","node":"0.6.12"}
I'm running ubuntu.

It turns out that I had used
apt-get install nodejs
when I configured my system. That install had issues, and I ultimately used NVM. Even though node -v returned the correct version, I had to use apt-get to uninstall "node" (which left NVM's version just fine). Now I have new problems, but they are unrelated.

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.

npm is not compatible with Node.js

I had node installed in my machine and everything was working fine. During an online course made in 2019, the instructor was using an earlier version of npm (v5.5.1) and advised everyone to use the same version with him for follow up reasons. So I downgraded to v5.5.1 but now I keep getting one same error (incompatibility) for almost all commands. I read some solutions to similar problems here and even tried extra steps but the problem still persists.
I uninstalled node from my system, restarted the system and reinstalled node but the version of npm still remained v5.5.1.
I tried to uninstall npm from the command line npm uninstall -g npm but it threw incompatibility error.
I searched the web for compatible version of node.js for npm v5.5.1 and got node v10.15.1 which I downloaded installed with several system restarts but my node and npm still remain incompatible. Please what can I do?
You should use nvm which is the Node Version Manager, cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
commands:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
Helpful reads:
How can the default node version be set using NVM?
How to change node version with nvm

update node impossible due to installed version

I'm trying to update node:
npm update npm -g
Everything seems to be ok, but with the command:
npm -v
I've this version:
7.19.1
So I've tried to use the node .msi file with the latest lts (V14.17.3) and I've an error message saying that I've already the last version installed!
What can I do?
npm and node are different applications so they have different version numbers.
Check your node version with the command:
node --version

Install nodejs 4.2.0 or above version

I have installed node and npm using following command in my Ubuntu machine:
sudo apt-get install nodejs npm
On checking version of installed, I could see following:
$ node -v && npm -v
v0.10.25
1.3.10
But I want nodejs version to be 4.2.0 or above. I am trying to install VSO Linux agent for a project. On executing node agent/vsoagent, I get error that node version should be 4.2.0 or above.
How do I install it and also make sure that the already installed ones are removed with node -v && npm -v gives me new version number?
Thanks
You already have npm, so you can use n manager to install any version you want (4.4.4 for ex): maybe you should use sudo for global install:
npm install -g n
n 4.4.4
Or
n latest
After that you can just run n to select version that you prefer. I use latest LTS and latest 6.x side-by-side and switching them anytime i want.

Why nodejs command line always install an old version?

My questions are
Whenever i tried to install nodejs using command line
# apt-get install nodejs
it installs the older version (in my case it installed 0.10.x),where as the current version till date is 4.1.2 .Why this command do not gives me a latest version.Is there any other way to install the latest version though i tried using nvm.
I checked the installed versions
node -v && npm -v && cordova -v
v0.12.7
3.3.5
5.3.3
It seems node v0.12.7 is installed in my system but when i am trying to install ionic
npm install -g cordova ionic
i am finding the error
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"}
(current: {"node":"0.12.7","npm":"3.3.5"})
even my current version is greater then the required version why its throwing me an error,do it strict with the specific version.
Do not make use of apt get, there is no harm in installing node using platform specific tools but it is better to make use of nvm which is consistent among all platforms.
Make sure to uninstall the current version of node this post can help.
Next follow these steps.
Go to https://github.com/creationix/nvm
Use curl to install nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash
Source your profile source ~/.profile
Install NodeJs nvm install v4.1.0
Alias installed version to default nvm alias default v4.1.0
Set aliased version as the final node version nvm use default
node -v will result in v4.1.0
In your case you may have to install version 0.10.x, you can also do nvm ls-remote to list available versions for download.
it's warning not an error so don't worry and if you want to install ionic platform then use bellow commands and still you face any problem then message me.
npm install -g ionic

Resources