Is it possible to install NVM when I already have installed nodejs 8 on Ubuntu?

偶尔善良 提交于 2021-01-22 05:12:25

问题


I have installed nodejs 8, I can't run karma tests with angular 1.. As specified on Karma official website Note: Karma currently works on Node.js 0.10, 0.12.x, 4.x, 5.x, 6.x, and 7.x. See FAQ for more info., I guess problem might be in my node version, they recommend to install node via NVM but I already have installed node 8.. is it possible to install nvm and include there my current nodejs?


回答1:


Q: Can I still install nvm when I already got an existing node installation?

A: Yes. nvm operates by altering your PATH environment variable to determine the node version your current shell session uses.

For instance when doing nvm use 6.10.3, you immediately can see that $PATH is set to;

PATH=/home/samuelt/.nvm/versions/node/v6.10.3/bin

which node resolves to

/home/samuelt/.nvm/versions/node/v6.10.3/bin/node

Since nvm always try to set the path of its node installation as the first occurrences in PATH even if you have 10 other node installation paths in PATH, the rest will be ignored once the system has found the node binary.

Q: Can I include my installed copy of Node as part of the installed node in nvm?

A: In theory it is possible. But I will say no. To install a particular node version in nvm you'll can do nvm install <version>



来源:https://stackoverflow.com/questions/45439495/is-it-possible-to-install-nvm-when-i-already-have-installed-nodejs-8-on-ubuntu

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