2017-03-15 159 views
1

为什么我不能简单地安装最新的nodejs。 我执行了curl -sL https://deb.nodesource.com/setup_7.x |须藤-E庆典 - 之后,我执行以下在Ubuntu 14.04上遵循最新nodejs的安装步骤有什么问题?

[email protected]:/$ 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. 

[email protected]:~$ which node 
[email protected]:~$ which nodejs 
[email protected]:~$ whereis node 
node: 
[email protected]:~$ whereis nodejs 
nodejs: 

[email protected]:/$ node -v 
The program 'node' can be found in the following packages: 
* node 
* nodejs-legacy 

OS是Ubuntu的14.04

+0

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

回答

0

尝试运行:

which nodejs 

如果该命令的结果采取的目录位置,并创建一个符号链接为'节点'名称。

的命令应该是这个样子:

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

。结果是一样的。更新了问题。 – ishandutta2007

+0

您是否尝试安装nodejs-legacy? –

+0

如果您只是导航到/ usr/bin /有没有节点文件?不要相信第二个地方和哪个地方。 –

0

清洗和安装工作:

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