Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

So, it looks like:

#node
#

or

#forever
#forever --help
#forever listall
#

Everything else not node-related runs fine.

like image 598
JVE999 Avatar asked Jul 13 '14 09:07

JVE999


People also ask

How do I run NodeJS permanently?

js application locally after closing the terminal or Application, to run the nodeJS application permanently. We use NPM modules such as forever or PM2 to ensure that a given script runs continuously. NPM is a Default Package manager for Node.

Why do you use forever with NodeJS?

The purpose of Forever is to keep a child process (such as your node. js web server) running continuously and automatically restart it when it exits unexpectedly.

Why is node command not working?

Make sure the node path is added, if not added it. After doing this restart Visual Studio or open a fresh command prompt. From the command prompt type 'node -v' to echo the node version installed. You can also add the path to node or any other application directly on the command line.

How do I use NPM forever?

Forever is an npm package used to keep your script running continuously in the background. It's a handy CLI tool that helps you to manage your application in the development and production stages. To start running a script with forever, use the forever start command, followed by the script name.


3 Answers

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.

I uninstalled it with

apt-get purge node

Then, I downloaded the 64-bit linux binary from here: http://nodejs.org/download/

And I extracted it with tar -xvf filename, then I set that directory/bin to the path with:

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.

Here's the information about the program that was installed via apt-get install node:

Package: node
Priority: optional
Section: universe/hamradio
Installed-Size: 38
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Hamradio Maintainers <[email protected]>
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.

like image 141
JVE999 Avatar answered Oct 19 '22 21:10

JVE999


I had the same issue, and I think it was caused because I naively apt-get installed node first. Doing a

sudo apt-get purge node

Followed by the instructions on the web here (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.

EDIT: On one server I updated, node did exist. Not sure exactly what order things need to happen in, but whatever...

like image 35
Scott Stafford Avatar answered Oct 19 '22 20:10

Scott Stafford


I was having this issue, I found that to solve the issue, I needed to remove the node file within /usr/sbin/node (found with which node) and replace it with a hard link to /usr/bin/nodejs (found with which nodejs)

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

like image 8
rydrman Avatar answered Oct 19 '22 20:10

rydrman