Languages
[Edit]
EN

Node.js - install npm package locally

3 points
Created by:
Kenya-Spears
860

In this article, we would like to show you how to install npm package locally in Node.js.

As a local installation, we understand the packages are installed in the current project directory only.

Quick solution:

or shorter:

Notes:

  • that approach is useful when the project uses specific packages versions (it is most common way to install packages in a project),
  • go to last section to see how to install packages that are used only in developlemnt.

 

Installation variants

Edit

In this section, we present 2 installation variants: normal and development dependency installation.

1.  As normal dependency

Edit

Local installation in the current directory:

Before npm 5 we needed to use one of the variants:

2. As development dependency (devDependencies)

Edit

Development dependencies are not built into the production package - they are needed only for development,
e.g. nodemon, all @types/..., eslint, jest, typescript, etc.

or:

Alternative titles

  1. Node.js - install npm package as development dependency
  2. Node.js - install npm package as dev dependency
  3. Node.js - install npm package as devDependencies
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join