Next: npm CLI, Previous: Creating a Nodejs Module, Up: NPM Packages [Index]
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.
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]
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