Installing dependencies
Now that we know how to choose the correct dependencies for our projects, and we have a package.json we can start installing our dependencies.
Locally or globally
We can install dependencies in two ways: locally or globally:
- Locally: These are dependencies that are installed in the
node_modulesfolder of our project. For example,expressis a local dependency of our application. - Globally: These are dependencies that are installed in the global folder of our system, so they become available from anywhere in our system, such as Node.js binary, which is available as soon as we open the terminal.
We would prefer to install dependencies locally because it is easier to manage the dependencies of our project and to avoid conflicts between different projects. We will install dependencies globally only when it is strictly necessary.
One example of a dependency that we will install globally is yeoman, a scaffolding tool, which we will use to...