112

I've installed node.js in my machine (linux mint 15), when I run node example.js, it says:

The program 'node' can be found in the following packages:
 * node
 * nodejs-legacy
Try: sudo apt-get install <selected package>

So what are the differences between node and nodejs? I had both node.js and node installed previously, but when I run node example.js, the web server doesn't start at all. So I deleted node and kept node.js.

1

3 Answers 3

160

The package node is not related to node.js.

nodejs is what you want, however it is arguably better to have the command be called node for compatibility with scripts that use #!/usr/bin/env node.

You can either just create a symlink in your path:

sudo ln -s `which nodejs` /usr/local/bin/node

Or you could install nvm and then use it to install the latest version of node.js:

nvm install stable

I prefer the nvm method, as it allows you to sudo apt-get remove nodejs, and then manage which version of node you're using yourself. You can also have multiple versions of node.js installed and use nvm use <version> to easily switch between them.

I also like to add a line to the bottom my .bashrc like: nvm use stable > /dev/null. That will automatically use the latest version you have installed.

To update your node version to the latest stable: nvm install stable. Every time you do this you will need to install any npm packages that you had installed globally if you want to continue using them.

To switch to an old version just run nvm use <version>, or, if you don't have the old version installed already: nvm install <version>.

5
  • 28
    actually, the nodejs-legacy package just contains the symlink (see also lists.debian.org/debian-devel-announce/2012/07/msg00002.html).
    – someonr
    Commented Jan 20, 2015 at 20:10
  • 1
    Very helpful and handy is nvm package. Commented Oct 17, 2015 at 19:26
  • In JS world, people keep calling node; in that case does it refer to node.js ?
    – vikramvi
    Commented Jul 19, 2019 at 11:39
  • 1
    @vikramvi Yes, when you here people talking about node they are probably refering to node.js; either that or DOM nodes in a browser
    – Paul
    Commented Jul 19, 2019 at 12:51
  • The decision to name node and nodejs so similarly has to be the dumbest naming decision in computer history. One or both should be renamed.
    – niico
    Commented Aug 11, 2022 at 15:10
40

This answer is just to tell you the difference between node and nodejs packages on Debian OS.

node

nodejs

  • Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
  • Package details link:
4
  • 13
    The answer that explains the actual difference between node and nodejs.
    – Bono
    Commented Jun 29, 2017 at 11:40
  • 2
    How will I understand the difference between the two in layman's language? Commented Mar 27, 2018 at 8:50
  • 4
    @steady_daddy The two packages are unrelated to each other, so the simple answer is that the two are unrelated. nodejs is a modern javascript-oriented server framework typically used to provide various services and realtime applications, while node is an older framework for transmitting data packets over amateur radio. Most installations symlink the shell command "node" to the binary "nodejs" and this is usually safe to do since hardly anyone using nodejs will encounter conflicts with "node". Commented Jan 17, 2019 at 6:29
  • 1
    man node and man nodejs Yield the same exact manual pages on my WSL Debian Hmm ..... No mention of amateur radio. They both talk about node.js. Commented Jul 27, 2023 at 23:26
5

There is a simple answer.

  1. Node.JS is the script/code
  2. Node compiles and runs the Node.JS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.