3

I'm trying to install nvm on Ubuntu 14.04 but it doesn't seem to use the version I specify. I installed following the tutorial here https://github.com/creationix/nvm and I've also tried the one here https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps.

There are 2 node installations on my system already.

which node # => /usr/local/bin/node
node --version # => v0.11.13-pre
which nodejs # => /usr/bin/nodejs
nodejs --version # => v0.10.26

When I install nvm using the curl one liner they give you, and then use

nvm install 0.10.32

It creates an empty folder inside .nvm/v0.10.32 and .nvm/current symlinks to it. In addition the bin folder is also empty. This problem occurs if I install other versions of node. I suppose I could just clone a version of node into the folder its supposed to go in but idk if that's all I have to do. In addition, I'm not sure I know how to make my system use the nvm current (symlink from /usr/local/bin/node to .nvm/current ?) Without doing anything myself and only following the tutorial, node --version and nodejs --version never uses the version I specify with.

nvm use 0.10.32
4

3 回答 3

6

这是我的个人指南,如何安装 nvm(节点版本管理器)。

参考:https ://github.com/creationix/nvm

1.)安装nvm(注意:他们的网站上可能有新版本。)

卷曲 https://raw.githubusercontent.com/creationix/nvm/v0.24.0/install.sh | 重击

2.) 关闭当前终端并使用新终端,然后再次尝试 nvm。

3.) 使用以下命令安装当前 node.js 版本:
nvm install node_version
ex: nvm install 0.10.32

4.) 检查 nodejs 版本--> nvm 列表

5.) 在 nvm 中设置默认节点版本,以便每次重新启动系统时都会加载默认节点版本:

to get help: nvm -h
to get list of install node.js versions: nvm ls
to set a default alias: nvm alias default node_version

6.) 卸载特定的 node.js 版本:
nvm uninstall node_version

于 2015-03-27T15:36:47.930 回答
4

我知道我的回答可能已经过时了,但是票 #809中有一个非常好的论文,使用

$ npm install -g nvm

是错的。要修复,你想做

$ npm uninstall -g nvm
$ apt install curl
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
$ source ~/.bashrc
$ nvm install 5.1
$ nvm use 5.1

相反(鉴于curl尚未在该机器上安装)。

于 2016-06-21T12:16:47.583 回答
0

我刚刚删除了所有有问题的节点安装,直到我的系统使用了 0.10.* 版本。看来我之前尝试安装节点或其他程序安装它。

于 2014-09-23T02:19:27.820 回答