昨天兴致勃勃的玩了一天的node,今天开机想接着爽一把,结果提示让我安装Node,我去,昨天刚安装了,怎么还会出这样的提示?其实这真不是问题,看了一下nvm命令的帮助,so easy!
错误:(试了两次)
sunnylee@MyComputer:~$ node
The program ‘node‘ can be found in the following packages:
* node
* nodejs
Try: sudo apt-get install <selected package>
sunnylee@MyComputer:~$ node
The program ‘node‘ can be found in the following packages:
* node
* nodejs
Try: sudo apt-get install <selected package>
环境:Ubuntu 12.04
场景还原:
1.开机;
2.打开终端,键入命令node,出现上述错误。
错误原因:使用NVM命令(nvm use 0.11.11)选择安装过的版本, 问题即可解决。
个人博客:http://www.studyit.pw, 欢迎拍砖!
附:
NVM命令详解:
Usage:
nvm help Show this message
nvm --version Print out the latest released version of nvm
nvm install [-s] <version> Download and install a <version>, [-s] from source
nvm uninstall <version> Uninstall a version
nvm use <version> Modify PATH to use <version>
nvm run <version> [<args>] Run <version> with <args> as arguments
nvm current Display currently activated version
nvm ls List installed versions
nvm ls <version> List versions matching a given description
nvm ls-remote List remote versions available for install
nvm deactivate Undo effects of NVM on current shell
nvm alias [<pattern>] Show all aliases beginning with <pattern>
nvm alias <name> <version> Set an alias named <name> pointing to <version>
nvm unalias <name> Deletes the alias named <name>
nvm copy-packages <version> Install global NPM packages contained in <version> to current version
Example:
nvm install v0.10.24 Install a specific version number
nvm use 0.10 Use the latest available 0.10.x release
nvm run 0.10.24 myApp.js Run myApp.js using node v0.10.24
nvm alias default 0.10.24 Set default node version on a shell