简体   繁体   English

Nodejs 总是安装 4.2.6

[英]Nodejs always installing 4.2.6

I am installing latest version of nodejs in my localhost.我正在我的本地主机中安装最新版本的 nodejs。 But system is always installing the 4.2.6 version.How can i install the latest version.但是系统总是安装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 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

OR

Can anyone send the installation steps for installing from任何人都可以发送安装步骤

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

file.文件。

Thanks谢谢

In Linux/Mac systems, there is no better way than nvm - Node Version Manager .在 Linux/Mac 系统中,没有比nvm - Node Version Manager更好的方法了。

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 alias将您的版本设置为默认版本。

Note: If you're a happy user of new M1 Apple chip, install version 15 of Node.js with nvm, it supports it out of the box.注意:如果您是新 M1 Apple 芯片的满意用户,请使用 nvm 安装 Node.js 版本 15,它开箱即用。

Hey guys if you have Ubuntu 16 try this instructions.嘿伙计们,如果您有 Ubuntu 16,请尝试此说明。 It worked for me perfectly.Also provide your account password whenever asked in this process.它对我很有效。在此过程中,只要有要求,也请提供您的帐户密码。

  1. sudo su -c "echo 'deb https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list" 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" 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 sudo apt-get 更新

  4. apt-cache policy nodejs Check if the versions listed has node 8 apt-cache policy nodejs 检查列出的版本是否有节点 8

  5. sudo apt-get install nodejs sudo apt-get 安装 nodejs

  6. nodejs -v check the node version installed nodejs -v 检查安装的节点版本

This shall successfully install nodejs version 8 on your system.这将在您的系统上成功安装 nodejs 版本 8。 If you wish any other version, then change the version on step 1 and 2 it shall work successfully.如果您想要任何其他版本,请在步骤 1 和 2 中更改版本,它将成功运行。

For me - the solution was on this page:对我来说 - 解决方案在这个页面上:

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

... for the Latest release, add this PPA.. ... 对于最新版本,请添加此 PPA ..

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

To install the LTS release, use this PPA要安装 LTS 版本,请使用此 PPA

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

🍺 🍺

I am running Ubuntu 18.04 Bionic Beaver LTS ... so I needed version 8我正在运行 Ubuntu 18.04 Bionic Beaver LTS ......所以我需要版本 8

Current LTS instructions:当前的 LTS 指令:

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

Courtesy of https://github.com/nodesource/distributions#installation-instructionshttps://github.com/nodesource/distributions#installation-instructions 提供

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

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

sudo apt-get update sudo apt-get 更新

#Use this to remove the Previous Nodejs from Your device and then try again with Installing NVM #使用它从您的设备中删除以前的 Nodejs,然后再次尝试安装 NVM

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM