简体   繁体   English

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

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

I installed both node.js and forever.js and when I run them in my terminal (bash on Ubuntu 14.04), nothing happens. 我同时安装了node.js和forever.js,当我在终端上运行它们时(在Ubuntu 14.04上为bash),什么也没发生。

So, it looks like: 因此,它看起来像:

#node
#

or 要么

#forever
#forever --help
#forever listall
#

Everything else not node-related runs fine. 其他所有与节点无关的东西都运行良好。

There was something wrong with apt-get , so when installing node, it didn't actually install node, but it did put a program in the path that did seemingly nothing. apt-get出了点问题,因此在安装节点时,它实际上并没有安装节点,但是确实将程序放在了似乎没有任何作用的路径中。

I uninstalled it with 我用

apt-get purge node

Then, I downloaded the 64-bit linux binary from here: http://nodejs.org/download/ 然后,我从此处下载了64位linux二进制文件: http : //nodejs.org/download/

And I extracted it with tar -xvf filename , then I set that directory/bin to the path with: 然后使用tar -xvf filename提取它,然后使用以下命令将该directory/bin设置为路径:

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

And now it works fine. 现在工作正常。 The forever issue was because the node installed wasn't node at all, but instead a 30kb program of some sort, I don't know. 永远的问题是因为安装的节点根本不是节点,而是我不知道的某种30kb程序。

Here's the information about the program that was installed via apt-get install node : 这是有关通过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

So, I also found that the correct way to install node with apt-get is apt-get install nodejs . 因此,我还发现使用apt-get安装node的正确方法是apt-get install nodejs

I had the same issue, and I think it was caused because I naively apt-get installed node first. 我遇到了同样的问题,我认为这是由于我天真地先apt-get安装的节点而引起的。 Doing a 做一个

sudo apt-get purge node

Followed by the instructions on the web here ( https://github.com/nodesource/distributions ): 紧随其后的是网站( https://github.com/nodesource/distributions )上的说明:

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

fixed the issue for me. 为我解决了这个问题。 node doesn't exist, but nodejs does and other tools work (like slap ) now. node不存在,但是nodejs可以使用,其他工具也可以正常工作(例如slap )。

EDIT: On one server I updated, node did exist. 编辑:在我更新的一台服务器上,节点确实存在。 Not sure exactly what order things need to happen in, but whatever... 不确定到底需要什么顺序发生,但无论如何...

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

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

Just run nodejs command on your terminal after installing nodejs package. 安装nodejs软件包后,只需在终端上运行nodejs命令即可。

It will give you the JavaScript prompt or interpreter. 它将为您提供JavaScript提示或解释器。

The problem you are having is that apt-get installed NodeJS under the binary nodejs. 您遇到的问题是apt-get在二进制nodejs下安装了NodeJS。 Also when you do a npm install forever -g it also expects the binary to be node. 同样,当您永久安装npm -g时,它也希望二进制文件是节点。

To verify this you can do a 要验证这一点,您可以执行

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

to find the location of the forever script. 查找永久脚本的位置。 Then check the node binary it's trying to execute. 然后检查它试图执行的节点二进制文件。

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

This /usr/bin/env node needs to be changed to /usr/bin/env nodejs. 该/ usr / bin / env节点需要更改为/ usr / bin / env nodejs。

But to bypass this problem you should definitely look into using upstart. 但是要绕过这个问题,您绝对应该考虑使用upstart。 http://howtonode.org/deploying-node-upstart-monit http://howtonode.org/deploying-node-upstart-monit

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

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