【发布时间】:2016-08-16 19:16:02
【问题描述】:
我已经在我的 Ubuntu 14.04 上安装了 node.js 很长时间了。几个月前我安装了 nvm,一切都很顺利。几天前,当我尝试运行节点脚本时,我得到以下信息:
me@here~$: node
he program 'node' can be found in the following packages:
* node
* nodejs-legacy
Try: sudo apt-get install <selected package>
如果我随后使用 nvm 指定我想使用节点 (nvm use node),一切都会再次运行 - 直到我关闭终端或开始新会话。很烦人。
当然,如果我按照建议的操作去做
sudo apt-get install node
安装的不是node.js,而是其他一些不相关的包。
问题
我该怎么做才能使在任何终端会话上运行 node 解析为 nvm 之前设置的任何内容?
更新
从链接到另一个问题的 cmets 中,这就是我解决这个问题的方法:
“我还想在我的 .bashrc 底部添加一行:
nvm use stable > /dev/null这将自动使用您安装的最新版本。”
【问题讨论】:
-
具体看我对该问题的回答中的那一行:
"I also like to add a line to the bottom my .bashrc like: nvm use stable > /dev/null. That will automatically use the latest version you have installed."
标签: node.js command-line-interface nvm