Installing dependencies with npm

You can install any npm package in any folder containing a package.json file, using npm install <options> <package_name>.

After executing npm install a few times, you might wonder where those packages might be getting installed. First off, you need to know that npm packages can be installed in two different ways:

On Windows, global packages are installed by default under: %APPDATA%/npm.

You can find the official documentation of npm install here: https://docs.npmjs.com/cli/install.

Here are some examples of packages that you might consider installing globally:

There are actually hundreds of thousands of packages! Always be careful when choosing, as there are many potential pitfalls: abandoned ones, malicious ones, bogus ones, and many others.

You should also know that npm maintains a local cache. Sometimes, it might cause surprises. In those cases, refer to the official troubleshooting guide: https://docs.npmjs.com/troubleshooting/try-clearing-the-npm-cache.

Let's now discover the purpose of the package.json file.