Nodejs 总是安装 4.2.6

Nodejs always installing 4.2.6

我正在我的本地主机上安装最新版本的 nodejs。但是系统一直在安装4.2.6version.How我可以安装最新版本吗

我用过的指令:

sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs

安装后我检查过:

node -v

结果:

v4.2.6

apt-cache policy 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

谁能发下安装步骤

node-v8.2.1-linux-x64.tar.xz 

文件。

谢谢

在Linux/Mac系统中,没有比nvm - Node Version Manager更好的方法了。

安装:

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"

那么,用法就这么简单:

nvm install 8.0
nvm use 8.0

如果重启后您会看到旧版本,请使用nvm alias将您的版本设置为默认版本。

注意:如果您喜欢新的 M1 Apple 芯片,请使用 nvm 安装 Node.js 版本 15,它开箱即用。

嘿伙计们,如果你有 Ubuntu 16 试试这个指令。它对我有用 perfectly.Also 在此过程中每当被要求时提供您的帐户密码。

  1. sudo su -c "echo 'deb https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list"

  2. sudo su -c "echo 'deb-src https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list"

  3. sudo apt-get update

  4. apt-cache 策略 nodejs 检查列出的版本是否有节点 8

  5. sudo apt-get install nodejs

  6. nodejs -v 检查安装的节点版本

这将在您的系统上成功安装 nodejs 版本 8。如果您需要任何其他版本,请在步骤 1 和 2 中更改版本,它将成功运行。

对我来说 - 解决方案在这个页面上:

参考:https://websiteforstudents.com/install-the-latest-node-js-and-nmp-packages-on-ubuntu-16-04-18-04-lts/

...对于最新版本,添加此 PPA..

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -

要安装 LTS 版本,请使用此 PPA

curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -

我是 运行 Ubuntu 18.04 Bionic Beaver LTS ...所以我需要版本 8

当前的 LTS 指令:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

https://github.com/nodesource/distributions#installation-instructions

提供

sudo rm -rf /var/lib/apt/lists/*

sudo rm -rf /etc/apt/sources.list.d/*

sudo apt-get 更新

#使用它从您的设备中删除以前的 Nodejs,然后再次尝试安装 NVM