Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS programs fail, exiting with no output

Several of my node programs are exiting with a failure status and no output. E.g.:

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

Even though my nodejs seems to be working fine:

$ nodejs --version
v0.10.32

I'm running Ubuntu 14.04.

like image 390
Robin Winslow Avatar asked Feb 13 '23 00:02

Robin Winslow


1 Answers

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

$ 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 at /usr/bin/node, but some nodejs programs expect to find the binary for nodejs here.

The trick is to uninstall the node package, and then re-install nodejs:

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

Now the /usr/bin/node binary should be linked to nodejs (in a somewhat roundabout way):

$ 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
like image 51
Robin Winslow Avatar answered Feb 15 '23 12:02

Robin Winslow