繁体   English   中英

当我运行节点时,什么也没发生,永远一样

[英]When I run node, nothing happens, the same with forever

我同时安装了node.js和forever.js,当我在终端上运行它们时(在Ubuntu 14.04上为bash),什么也没发生。

因此,它看起来像:

#node
#

要么

#forever
#forever --help
#forever listall
#

其他所有与节点无关的东西都运行良好。

apt-get出了点问题,因此在安装节点时,它实际上并没有安装节点,但是确实将程序放在了似乎没有任何作用的路径中。

我用

apt-get purge node

然后,我从此处下载了64位linux二进制文件: http : //nodejs.org/download/

然后使用tar -xvf filename提取它,然后使用以下命令将该directory/bin设置为路径:

PATH=$PATH:/directory/to/node/bin

现在工作正常。 永远的问题是因为安装的节点根本不是节点,而是我不知道的某种30kb程序。

这是有关通过apt-get install node安装的程序的信息:

Package: node
Priority: optional
Section: universe/hamradio
Installed-Size: 38
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Hamradio Maintainers <debian-hams@lists.debian.org>
Architecture: all
Version: 0.3.2-7.4
Depends: ax25-node
Conflicts: nodejs-legacy
Filename: pool/universe/n/node/node_0.3.2-7.4_all.deb
Size: 1284
MD5sum: 7385a0f5916e03d9143459ca4706f0ec
SHA1: bf7aa087db81475636897ff39de344754ce1415b
SHA256: 9756770f771bcc4183cffa622f89e21a585be96bd4de27024b0a7cb167f310ad
Description-en: Amateur Packet Radio Node program (transitional package)
 The existing node package has been renamed to ax25-node. This transitional
 package exists to ease the upgrade path for existing users.
Description-md5: 1278ed271672fd829c99361f93f468da
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

因此,我还发现使用apt-get安装node的正确方法是apt-get install nodejs

我遇到了同样的问题,我认为这是由于我天真地先apt-get安装的节点而引起的。 做一个

sudo apt-get purge node

紧随其后的是网站( https://github.com/nodesource/distributions )上的说明:

curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs

为我解决了这个问题。 node不存在,但是nodejs可以使用,其他工具也可以正常工作(例如slap )。

编辑:在我更新的一台服务器上,节点确实存在。 不确定到底需要什么顺序发生,但无论如何...

我遇到了这个问题,我发现要解决该问题,我需要删除/ usr / sbin / node(找到which node )内的节点文件,并用到/ usr / bin / nodejs的硬链接(找到用which nodejs

ln /usr/bin/nodejs /usr/sbin/node

安装nodejs软件包后,只需在终端上运行nodejs命令即可。

它将为您提供JavaScript提示或解释器。

您遇到的问题是apt-get在二进制nodejs下安装了NodeJS。 同样,当您永久安装npm -g时,它也希望二进制文件是节点。

要验证这一点,您可以执行

永远的%
lrwxrwxrwx 1根根39 Jan 25 21:34 / usr / local / bin / forever-> ../lib/node_modules/forever/bin/forever

查找永久脚本的位置。 然后检查它试图执行的节点二进制文件。

%vim / usr / local / lib / node_modules / forever / bin / forever
#!/ usr / bin / env节点

该/ usr / bin / env节点需要更改为/ usr / bin / env nodejs。

但是要绕过这个问题,您绝对应该考虑使用upstart。 http://howtonode.org/deploying-node-upstart-monit

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM