Can somebody please tell me if I am using the wrong node js version?

倾然丶 夕夏残阳落幕 提交于 2021-02-11 18:25:25

问题


I have been trying to update nodejs for a long time now. When I run node -v, it tells me I am using: v0.10.40. But when I look at nodejs.org it says the v7.4.0?

I have cleaned the npm cache and done a reinstall with sudo n stable but still v0.10.40, and the last time that I updated npm it prompted me that my node version is too old and outdated.

What am I doing wrong. And can somebody tell me if v0.10.40 is the current or an outdated version?


回答1:


You likely have two versions of node installed and in your path. If you are on OSX or linux, run which node (if on Windows, you may npm i -g @raider/which, and then run which node). This should give you the location of the old version of node.

Then run mv path/to/old/node path/to/old/node.bak, replacing with the actual path, and rerun node --version to see if it picks up the right version now.

UPDATE: If you are on Ubuntu or another Debian based Linux, you should install the latest with the following commands:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs

UPDATE: If you are using nvm, run nvm install node followed by nvm use node in a new terminal to get the latest that nvm supports.



来源:https://stackoverflow.com/questions/41857238/can-somebody-please-tell-me-if-i-am-using-the-wrong-node-js-version

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!