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

2019-07-10 16:42发布

问题:

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.

回答1:

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.



标签: node.js npm nvm