NodeJS programs crash, exit without output

Several of my node programs exit with a failure status and no output. For example:.

$ npmunbox --help  # Error - no output
$ grover --version  # Error - no output

      

Even though my nodejs are working fine:

$ nodejs --version
v0.10.32

      

I am running Ubuntu 14.04.

+3


source to share


2 answers


The problem was that I had a package called "node - Node Amateur Packet Radio Program (Transitional Package)" (note: this is NOT nodejs):

$ dpkg -l | grep node
ii  ax25-node                                             0.3.2-7.4                                           amd64        Amateur Packet Radio Node program
ii  node                                                  0.3.2-7.4                                           amd64        Amateur Packet Radio Node program
ii  nodejs                                                0.10.32-1chl1~trusty1                               amd64        Node.js event-based server-side javascript engi

      

This binary is in /usr/bin/node

, but some programs nodejs

expect to find binary here nodejs

.

The trick is to remove the package node

and then reinstall nodejs

:

$ sudo apt-get purge node nodejs  # Uninstall both
$ sudo apt-get install nodejs  # Reinstall nodejs

      



Now the binary /usr/bin/node

should be linked with nodejs

(somewhat workaround):

$ ls -l /usr/bin/node /etc/alternatives/node
lrwxrwxrwx 1 root root 15 Sep 18 15:57 /etc/alternatives/node -> /usr/bin/nodejs
lrwxrwxrwx 1 root root 22 Sep 18 15:57 /usr/bin/node -> /etc/alternatives/node

      

And your nodejs programs should now work correctly:

$ npmunbox --help
npmunbox - Extracts a .npmbox file and installs the contained package.
...
$ grover --version
0.1.17

      

+4


source


If you have already installed nodejs along the side of node (not related to node.js) instead node --version

usenodejs --version



0


source







All Articles