【发布时间】:2017-10-17 03:13:29
【问题描述】:
我已经在我的 MacOS 环境中构建了一个在 Node 上运行的 Javascript 应用程序,并且一切正常。现在我已经创建了一个 Azure Ubuntu 服务器,并从我的机器中同步了源代码。
我通过安装 npm、node 和所有必需的包来复制应用程序要求。我通过 SSH 连接到服务器,当我从 Ubuntu 服务器运行应用程序时,通过
$node app.js
所有返回的是
$
读到 Ubuntu 使用 nodejs-legacy,我也尝试过
$nodejs app.js
同样的结果
$node -v
v4.7.2
我还构建了一个 package.json 文件,并在使用
执行时npm start
它立即返回到 $。
【问题讨论】:
-
你是如何安装节点的?在像 Ubuntu 这样的基于 Debian 的发行版上,有一个名为 node 的业余无线电软件。所以如果你
apt install node它会安装一些完全不同的东西。你需要apt install nodejs nodejs-legacy npm -
是的,我就是这样安装的
$ sudo apt install nodejs nodejs-legacy npm Reading package lists... Done Building dependency tree Reading state information... Done nodejs is already the newest version (4.7.2~dfsg-1ubuntu3). nodejs-legacy is already the newest version (4.7.2~dfsg-1ubuntu3). npm is already the newest version (3.5.2-0ubuntu4). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.