npm

npm (Node Package Manager) is a command line tool and helps organizes and install packages in our JS project.

* Node is a JS runtime, to run JS locally in your computer instead of in a browser.

npm is automatically installed along with Node.js so to check if you already have it in you computer run:

node -v

If a version doesn’t appear you can use the Node Version Manager to install Node.js.

To check the version of npm:

npm -v

To update it:

npm install --global npm

npm works with the package.json file and has a command to create it: npm init

The package.json file includes info about the project andĀ tells to npm which packages are required for the project. When we run npm installĀ in a project with a package.json file, npm downloads and install all packages listed in the file from npmjs.com.

If you are working in a local environment running npm install creates the folder node_modules, with all the downloaded packages.

To install more packages than the listed in the package.json, run:

npm install <name_of_the_package>