【问题标题】:Node.js installation errorNode.js 安装错误
【发布时间】:2015-11-12 15:44:06
【问题描述】:

我已经按照https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server安装了Node.js、NVM和NPM

我的工作目录如下所示:

Working_Files\WebRTC,其中包含文件:

  • package.json
  • server.js

Working_Files\WebRTC\views,其中包含一个索引文件:

index.ejs

在 Working_Files\WebRTC 中,为了运行服务器,使用:

  node server.js

每次我都必须重复安装中解释的过程,否则我会收到错误:

 node server.js 
 The program 'node' can be found in the following packages:
  * node
  * nodejs-legacy
  Try: sudo apt-get install <selected package>

请问错误在哪里?

谢谢

【问题讨论】:

  • 您达到了手册的哪一部分?还是你都顺利完成了?
  • sudo apt-get update sudo apt-get install node.js sudo apt-get install npm sudo apt-get install build-essential --------------- ------------------------------------------------ sudo apt-get update sudo apt-get install build-essential libssl-开发 nvm 安装 .... nvm 使用 ....

标签: linux node.js installation


【解决方案1】:

试试这个:sudo ln -s "$(which nodejs)" /usr/bin/node

然后再次运行node server.js

【讨论】:

  • 谢谢,工作得很好,您认为问题出在哪里?
  • 在 apt-get 包管理器中,有另一个程序使用 'node' 命令,所以... NodeJS 包使用 nodejs 命令。使用 sudo ln -s "$ (which nodejs)" /usr/bin/node ',你从 node 更改 nodejs :)
猜你喜欢
  • 2015-06-16
  • 2016-02-29
  • 2015-02-18
  • 1970-01-01
  • 2014-08-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-12
相关资源
最近更新 更多