Next: , Previous: , Up: NPM Packages   [Index]


3.2.3 Specifying Dependencies and DevDependencies

To specify the packages your project depends on, you must list them as "dependencies" or "devDependencies" in your package’s package.json file. When you (or another user) run npm install, npm will download dependencies and devDependencies that are listed in package.json that meet the semantic version requirements listed for each.

dependencies

Packages required by your application in production.

To add an entry to the "dependencies" attribute of a package.json file, on the command line, run the following command:

npm install <package-name> [--save-prod]
devDependencies

Packages that are only needed for local development and testing.

To add an entry to the "devDependencies" attribute of a package.json file, on the command line, run the following command:

npm install <package-name> --save-dev