2

I am using ubuntu 14.04 and when i use node hello.js command on terminal nothing happens. I installed the packages using sudo apt-get command. I don't know what is wrong. No error message or anything. I searched for my problem but couldnt find anything.

user3526673
  • 63
  • 2
  • 7
  • 1
    What's the content of the `hello.js`? – jgillich Apr 29 '14 at 18:19
  • I just wrote console.log("Hello"); to test the command out @jgillich – user3526673 Apr 29 '14 at 18:20
  • Weird. What does `node -v` return? – jgillich Apr 29 '14 at 18:22
  • On Ubuntu, you'll have to use `nodejs hello.js`. This is due to `node` already representing a different application, [as described in the installation guide](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint-elementary-os): "*There is a naming conflict with the node package (Amateur Packet Radio Node Program), [...]*" – Jonathan Lonowski Apr 29 '14 at 18:23
  • nodejs command worked. Does it have any difference with node or can i use it like i am using node command? – user3526673 Apr 29 '14 at 18:27

1 Answers1

6

The problem has to do with package naming. The node package in Debian/Ubuntu is not node.js, it's amateur packet radio software.

My suggestion is that if you want node.js, remove the existing node program (sudo apt-get purge node for Debian/Ubuntu) and follow the instructions here for your particular distro/platform. That should get you the latest stable version, which you should be able to verify with node -v.

mscdex
  • 104,356
  • 15
  • 192
  • 153
  • Someone suggested using nodejs and it worked. Would using it make any difference? – user3526673 Apr 29 '14 at 18:44
  • The `nodejs` package in the official Ubuntu repositories can become stale fairly quickly because of Ubuntu/Debian's policies on versions for stable OS releases. The reason I recommended the PPA was because that is a repository that is kept up to date with the latest stable node.js releases. – mscdex Apr 29 '14 at 18:47