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
.bashrcor.zshrcfile. - Activate the
--use-on-cdconfig to automatically use the correct version on each project:- In the commands you pasted in your
.bashrcor.zshrcfile, 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:
nodeis the programming language itself, which allow us to run scripts in javascriptnpmis the node package manager, which we will use to install dependencies