Npm - Package Dependency

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

1 - About

package Dependency in Node.

Dependency are declared in package.json

!!!!!!!! Duplicate of local package !!!!!!!!!!!!

Advertising

3 - Management

3.1 - Installation

It will get the dependency from the package.json file

Installation of all dependency of a cloned project.

  • for dev
git clone url
yarn install
# or
npm install
npm ci

3.2 - Add a dependency to your project

This two command will modify the dependency properties of package.json

  • A dependency needed to run your application when shipped
cd DirectoryOfPackage.Json
yarn add packageName1 packageName2...
# or
npm install packageName --save
  • A dependency needed to build your application (test, packaging,…)
cd DirectoryOfPackage.Json
npm install packageName --save-dev

Optionally, you can install a package without adding it as a dependency

npm install packageName --no-save

By default, npm adds your package using the caret operator in front of the version number (for example, ^3.5.2). We recommend using the tilde operator instead (for example, ~3.5.2), which limits updates to the most recent patch-level version.

Advertising
web/javascript/npm/dependency.txt · Last modified: 2019/05/20 17:40 by gerardnico