Npm - Local Package (Dependency)

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript) > Node - npm cli (Node package manager)

1 - About

A local package is a dependency for your module (versus global)

The installation of dependency is the npm install's default behavior.

For global package (Client), see Node - Global Package (Cli).

!!! Duplicate of dependency !!!!!!!


3 - Management

npm install will create the node_modules directory in the current directory (if one doesn't exist yet), and will download the package to that directory.

3.1 - Type of dependency relationship

  • dependencies - dependency in the code used to build the dependency graph.
  • devDependencies - build and test dependency that are not needed in the dependency graph (bundler, test harnesses or transpilers)
  • peerDependencies for Plugin. The peerDependency property defines the parent module. It indicates that your module cannot be used without this dependency.
  • bundledDependencies: an array of package names that will be bundled when publishing the package. npm pack
  • optionalDependencies: build dependency failures do not cause installation to fail

3.2 - Dependency

  • Installation
npm install <package_name>
npm install --save <package_name>
  • Uninstall
npm uninstall <package_name>
npm uninstall --save <package_name>

3.3 - Dev Dependency

npm install --save-dev <package_name>
npm uninstall --save-dev <package_name>

See npm install doc

3.4 - Location

The node_modules directory in the current directory.

3.5 - Update

in the same directory as your package.json file.

npm update

3.6 - Outdated

npm outdated

No output !


3.7 - Size

web/javascript/npm/package_local.txt · Last modified: 2019/06/16 08:45 by gerardnico