无法在 Ubuntu 14.04 上安装最新的 NodeJS 版本

Edi*_*yan 13 nodejs software-installation 14.04

在我的服务器我有0.10.25“我不需要雷亚的版本,那就是‘0.10.30’这是LTS的nodejs,但是开发商要求安装第4版,挖一点后,我发现,0.12它同样nodejs兼并了一些其他包。

没有包源0.12,我已经从.tar.gznodejs的网站下载文件,解压,但它不包含任何安装脚本,手动移动文件或创建链接不是我想要的方式,我该怎么办?

更新:

[web01]~> nodejs -v
v0.10.25
[web01]~> apt-get install curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[web01]~> curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
[web01]~> apt-get install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[web01]~> uname -a
Linux web01.example.lab 3.19.0-28-generic #30~14.04.1-Ubuntu SMP Tue Sep 1 09:32:55 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[web01]~> 
Run Code Online (Sandbox Code Playgroud)

hg8*_*hg8 14

安装 NodeJS 的最简单方法是使用官方 PPA(其中包含最新版本(本次编辑时为 8.X)。

打开终端(Ctrl+ Alt+ T)和运行:

  1. 删除当前的 NodeJS 安装

    sudo apt-get purge nodejs*
    
    Run Code Online (Sandbox Code Playgroud)
  2. 安装 curl

    sudo apt-get install curl
    
    Run Code Online (Sandbox Code Playgroud)
  3. 安装 Node.js:

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
    Run Code Online (Sandbox Code Playgroud)

如果您绝对需要 0.12 而不是 4.1.1 版本,请运行:

  1. 安装 Node.js:

    curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
    sudo apt-get install -y nodejs
    
    Run Code Online (Sandbox Code Playgroud)

  • 这无济于事,请参阅相关更新。 (2认同)