Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications.
The platform runs on
- Linux, OS X,
- FreeBSD,
- MacOS
- and Windows.
Install with Setup file
In order to install node you need , you can download a setup executable from the official site
Now it's the time to test Node.
To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type node -v .
Install with NVM
You can also install the node version by using nvm.
nvm is the node version manager that can install multiple version of the node runtime.
To install or update nvm, you can use the install script using cURL:
curl -o- https://raw.githubusercontent.com/creationix
vm/v0.33.2/install.sh |bash
or you can use Wget
wget -qO- https://raw.githubusercontent.com/creationix
vm/v0.33.2/install.sh |bash
Test it!
Make sure you have Node and NPM installed by running simple commands to see what version of each is installed and to run a simple test program:
- Test Node.
To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type
node -v
. This should print a version number, so you’ll see something like thisv0.10.35
. - Test NPM.
To see if NPM is installed, type
npm -v
in Terminal. This should print NPM’s version number so you’ll see something like this1.4.28
- Create a test file and run it.
A simple way to test that node.js works is to create a JavaScript file: name it
hello.js
, and just add the codeconsole.log('Node is installed!');
. To run the code simply open your command line program, navigate to the folder where you save the file and typenode hello.js
. This will start Node and run the code in thehello.js
file. You should see the outputNode is installed!
as explained also in order to verify the installation that nvm installed correctly issue the following command:
command -v nvm
which should output 'nvm' if the installation was successful. Please note thatwhich nvm
will not work, sincenvm
is a sourced shell function, not an executable binary.
Node.js applications can be run at the command line, but you can also on run them as a service,
so that they will automatically restart on reboot or failure, and can safely be used in a production environment.