【问题标题】:Cannot update the version of nodejs ubuntu 15.01无法更新nodejs ubuntu 15.01的版本
【发布时间】:2016-03-31 07:06:56
【问题描述】:

我不明白为什么即使我在nodejs的网站上写完全相同的行也无法实现 nodejs documentation says that

for Alternatively, for Node.js v5:

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

当我按照它说的说明进行操作时;

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 218 not upgraded.
Need to get 0 B/684 kB of archives.
After this operation, 3.116 kB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 175307 files and directories currently installed.)
Preparing to unpack .../nodejs_0.10.25~dfsg2-2ubuntu1_amd64.deb ...
Unpacking nodejs (0.10.25~dfsg2-2ubuntu1) ...
Processing triggers for doc-base (0.10.6) ...
Processing 1 added doc-base file...
Processing triggers for man-db (2.7.4-1) ...
Setting up nodejs (0.10.25~dfsg2-2ubuntu1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode

如你所见;

Preparing to unpack .../nodejs_0.10.25~dfsg2-2ubuntu1_amd64.deb ...

如何安装最新版本?

【问题讨论】:

  • 或者,您可以使用nvm

标签: node.js ubuntu ubuntu-15.10


【解决方案1】:

检查当前的 Node.js 版本:

node -v

强制清理缓存:

sudo npm cache clean -f

安装 n 模块:

sudo npm install -g n

安装最新的 Node.js:

sudo n stable

设置二进制链接(为您安装的任何版本更改 7.6.0):

sudo ln -sf /usr/local/n/versions/node/7.6.0/bin/node /usr/bin/node

再次检查 Node.js 版本:

node -v

你可以check this link

【讨论】:

    【解决方案2】:

    您可以使用https://github.com/tj/n

    sudo npm install -g n
    sudo n latest
    

    【讨论】:

    • sudo n 最新结果如下; cp: cannot stat ‘/usr/local/n/versions/node//bin’: No such file or directory cp: cannot stat ‘/usr/local/n/versions/node//lib’: No such file or directory cp: cannot stat ‘/usr/local/n/versions/node//include’: No such file or directory cp: cannot stat ‘/usr/local/n/versions/node//share’: No such file or directory
    • 尝试安装openssl,sudo apt-get install openssl
    • 我有 openssl 它的版本是:OpenSSL 1.0.2d 9 Jul 2015
    【解决方案3】:

    你是在代理环境吗? 如果是这样,请使用“sudo -E”而不是“sudo”。

    $ sudo n stable --> NG
    $ sudo -E n stable --> Maybe OK... (I hope so.)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-10
      • 2020-11-11
      • 2014-12-23
      • 2021-06-25
      • 2019-11-08
      • 2018-10-16
      • 2018-03-07
      • 1970-01-01
      相关资源
      最近更新 更多