【问题标题】:What is wrong with following installation steps of latest nodejs on Ubuntu 14.04?在 Ubuntu 14.04 上遵循最新 nodejs 的安装步骤有什么问题?
【发布时间】:2017-03-16 07:48:38
【问题描述】:

为什么我不能简单地安装最新的 nodejs。 我已经执行 curl -sL https://deb.nodesource.com/setup_7.x |须藤 -E bash - 之后我执行了以下操作

ubuntu@ip-172-31-2-33:/$ sudo 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 188 not upgraded.

ubuntu@ip-172-31-2-33:~$ which node
ubuntu@ip-172-31-2-33:~$ which nodejs
ubuntu@ip-172-31-2-33:~$ whereis node
node:
ubuntu@ip-172-31-2-33:~$ whereis nodejs
nodejs:

ubuntu@ip-172-31-2-33:/$ node -v
The program 'node' can be found in the following packages:
 * node
 * nodejs-legacy

操作系统是 Ubuntu 14.04

【问题讨论】:

  • 您是否尝试过运行which nodejs。我在 Vagrant 配置中遇到了类似的问题,解决方案是将 /usr/bin/ 中存在的 nodejs 包软链接到同一目录中的 node

标签: node.js ubuntu ubuntu-14.04


【解决方案1】:

试运行:

which nodejs

如果此命令有结果,则获取该目录位置并使用“节点”名称为其创建符号链接。

该命令应如下所示:

sudo ln -s /usr/bin/nodejs /usr/bin/node

【讨论】:

  • 如果您只是导航到 /usr/bin/ 是否有节点文件?暂时不要相信哪个和在哪里。
【解决方案2】:

清除和安装工作:

sudo apt-get purge nodejs*
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install -y nodejs
which nodejs

/usr/bin/nodejs

which node

/usr/bin/节点

node -v

v7.7.3

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-30
    • 1970-01-01
    • 1970-01-01
    • 2017-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多