I am installing latest version of nodejs in my localhost. But system is always installing the 4.2.6 version.How can i install the latest version.
我在localhost中安装最新版本的nodejs。但系统总是安装4.2.6版本。如何安装最新版本。
Commands i have used:
我用过的命令:
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs
After installing i have checked:
安装完毕后我检查过:
node -v
Result:
v4.2.6
Output of apt-cache policy nodejs
:
apt-cache策略nodejs的输出:
Installed: 4.2.6~dfsg-1ubuntu4
Candidate: 4.2.6~dfsg-1ubuntu4
Version table:
*** 4.2.6~dfsg-1ubuntu4 500
500 http://archive.ubuntu.com/ubuntu xenial/universe amd64
Packages
100 /var/lib/dpkg/status
OR
Can anyone send the installation steps for installing from
任何人都可以发送安装步骤来安装
node-v8.2.1-linux-x64.tar.xz
file.
Thanks
1 个解决方案
#1
10
In linux systems, there is no better way than nvm - Node Version Manager.
在Linux系统中,没有比nvm更好的方法 - 节点版本管理器。
Install:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
Then, usage is as simple as:
然后,用法很简单:
nvm install 8.0
nvm use 8.0
If after reboot you will see old version, use nvm alias
to set your version as default one.
如果重启后您将看到旧版本,请使用nvm别名将您的版本设置为默认版本。
#1
10
In linux systems, there is no better way than nvm - Node Version Manager.
在Linux系统中,没有比nvm更好的方法 - 节点版本管理器。
Install:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
Then, usage is as simple as:
然后,用法很简单:
nvm install 8.0
nvm use 8.0
If after reboot you will see old version, use nvm alias
to set your version as default one.
如果重启后您将看到旧版本,请使用nvm别名将您的版本设置为默认版本。