Node.js
- Windows
- MacOS/Linux
- Download Node.js LTS from the official website. We recommend you to use the LaTest Stable version of Node (also called the "LTS" version). Currently, it is the 16.15.0 version.
- Install Node.js by clicking on the executable you just downloaded.
- Install fnm to manage multiple node versions:
- Copy-paste the commands given at the end of the installation script into
your
.bashrc
or.zshrc
file. - Activate the
--use-on-cd
config to automatically use the correct version on each project:- In the commands you pasted in your
.bashrc
or.zshrc
file, replacebyeval "$(fnm env)"
eval "$(fnm env --use-on-cd)"
- In the commands you pasted in your
Now, check that the installation was successful:
- Open a terminal and run
node -v
, and thennpm -v
. - You should get a version number for each command. If you get an error such as
command not found
, the installation did not work. You can also have to restart your computer to make it work.
As you saw, node.js comes with two different commands:
node
is the programming language itself, which allow us to run scripts in javascriptnpm
is the node package manager, which we will use to install dependencies