node --version
v4.5.0
npm --version
2.15.9
node-gyp --version
v3.4.0
which node
/home/admin/.nvm/versions/node/v4.5.0/bin/node
For some reason, after running sudo npm install -g node-gyp
- node-gyp installs with node v0.10.25:
npm WARN engine cryptiles@2.0.5: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.10"})
npm WARN engine boom@2.10.1: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.10"})
npm WARN engine hoek@2.16.3: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.10"})
I've accessed /home/admin/.nvm/versions/node/
and found those folders: v4.4.4, v4.4.7, v4.5.0
.
Can someone trigger the issue ? Where is that v0.10.25 version and how do I get rid of it ?
The issue is that you, as a normal user , are using nvm
, Node Version Manager, which allows you to install different (newer/older) versions of Node independently of the system-installed version of Node (which, in your case, is 0.10.25).
When you install node-gyp
using sudo
, you're "switching" to a different user (root), for which the nvm setup doesn't apply. Hence, the system-installed version of Node will be used, triggering the error you're getting.
You have a few solutions:
sudo
when installing node-gyp
. Because you're using nvm
, you already have all the permissions required to install it as a normal user.You might have to clean/remove the other versions of Node. Perhaps the easiest is to remove everything and then install afresh. There's a script ( install.sh
) for this on npmjs.org site . Simply run this on your terminal and then it should remove any old installations and install the latest version.
Give it a try and let me know if this helps. It seems to have worked for closely related problem here .
I had the same problem. i found that i had a node.exe file with old version, and in the PATH (environment variables) i had a link to this old node.exe folder. once removing it from the path (and restarting cmd) the problem was fixed
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.