Nodejs 总是安装 4.2.6 [英] Nodejs always installing 4.2.6

查看:59
本文介绍了Nodejs 总是安装 4.2.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在本地主机中安装最新版本的 nodejs.但是系统一直在安装4.2.6版本,怎么才能安装最新版本.

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.

我使用过的命令:

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 - 节点版本管理器.

In Linux/Mac systems, there is no better way than 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 将您的版本设置为默认版本.

If after reboot you will see old version, use nvm alias to set your version as default one.

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

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.

这篇关于Nodejs 总是安装 4.2.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆