node.js - 无法安装 NodeJs :/usr/bin/env: node: No such file or directory

标签 node.js ubuntu gruntjs npm-install node-modules

我正在尝试将 nodeJs 安装到我的 Ubuntu 14.04 中以使用 GruntJs。

我读过 Ubuntu different way这样做(issues?),所以这是我为了安装它所做的:

sudo apt-get install npm

sudo npm install -g grunt-cli

输入 grunt 后出现错误:

/usr/bin/env: node: No such file or directory

所以,我试过了:

curl -sL https://deb.nodesource.com/setup | sudo bash -

sudo apt-get install -y nodejs

sudo apt-get update

再试一次,还是报错,我试过了:

sudo add-apt-repository https://launchpad.net/~chris-lea/+archive/node.js/

sudo apt-get install -y nodejs

我收到了这条消息:

nodejs is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 3 not to upgrade.

我确实尝试过清理以防万一:

sudo apt-get autoremove

但是不,错误仍然存​​在:当我输入 grunt 时,我仍然得到 /usr/bin/env: node: No such file or directory

我该怎么办?

最佳答案

做一个符号链接(symbolic link)解决了这个问题:

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

(感谢并为 bodokaiser's answer +1 投票)。

关于node.js - 无法安装 NodeJs :/usr/bin/env: node: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26320901/

相关文章:

node.js - Node.js 是否内置了对 UDP(datagams) 的支持?

node.js - 使用异步 waterfall 传递参数

java - Tomcat7 在 ubuntu Eclipse Juno 中抛出异常

javascript - 使用 Karma 测试 Angular 代码时出现的问题

node.js - 从 Debian 服务器上的 Node.js 应用程序生成电子邮件

mysql - 使用 node-mysql 和 ExpressJS 在一个请求中执行两个或多个查询

java - MapReduce 作业失败——线程中的异常 "main"java.io.IOException : java.net.ConnectException

linux - Ubuntu 16.04 上的网络模拟器 (Netem)

gruntjs - 将新的 zurb Foundation 6 与 yeoman/grunt 结合使用

curl - 如何从 Travis CI 上传到 FTP