Checking version of nodejs returns nothing
Solution 1
Try
nodejs --version
(at least on my system the binary is called nodejs)
Solution 2
you seriously do not want to use apt-get
to install NodeJS on ubuntu.
ubuntu's way of packaging 3rd party software means that you will always get outdated versions unless you have very active maintainers or slow software dev cycles—both of which are not true for NodeJS and the NodeJS package maintainers. i just checked and it looks like apt-get install nodejs
will give you a v0.6.19 install, which is from june 2012—as of september 2013, when NodeJS has already hit stable v0.10.18, with considerable internal changes.
one more reason you do not want to apt-get
NodeJS is that the executable will be called nodejs, for the simple reason that in the vast global namespace that is a contemporary linux distro, node
had already been assigned to a an unrelated software when NodeJS hit the scene.
you probably want to compile NodeJS yourself, or try out one of the binary packages they have for download on nodejs.org.
Solution 3
To go off of @flow, he is absolutely right. What you want to do is download the latest version from the Node repository with PPA (don't worry, it's super easy).
Type the following commands and you should be all set:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Solution 4
This question deserves a new answer.
If correctly installed, just type nodejs --version
or node --version
to check the version.
If you need a newer and well maintained repository
A good option is to use NodeSource repositories, that are very well mantained.
Follow these steps (note the new setup script name for Node.js v0.12)
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
Then install with:
sudo apt-get install -y nodejs
Using # nodejs --version
now will return v0.12.4
Related videos on Youtube
thank_you
Updated on September 18, 2022Comments
-
thank_you over 1 year
I'm trying to install node js onto Ubuntu so that I can run AngularJS. I'm not sure if I've installed it before so I ran
sudo-apt get install node
and once that is done I then runnode --version
but nothing is returned on my terminal.jason@jason:~$ node --version jason@jason:~$
How do I check if nodejs is installed?
-
Admin over 11 yearsthat worked for me
-
-
Pawelmhm over 10 yearsGood point! OP can also add node's actively maintained repo to repositories list as described in this post here: github.com/joyent/node/wiki/…
-
Michael Martin-Smucker over 9 years+1, I use NVM to avoid permissions issues (e.g. using
sudo
fornpm install -g
), but even without that it's best to stay away from the official repos here. -
atilkan over 8 yearsworked. But i don't get why it is older version. v0.10.25 currently v 0.12
-
Sergey over 8 years@emrah: Yes, Ubuntu's version of Node is often a bit old. Try nodesource PPA: github.com/nodesource/distributions