tldr/pages/common/npm.md

38 lines
850 B
Markdown
Raw Normal View History

2014-03-04 01:43:17 +00:00
# npm
> JavaScript and Node.js package manager.
> Manage Node.js projects and their module dependencies.
2019-01-30 11:19:23 +00:00
> Homepage: <https://www.npmjs.com/>.
2014-03-04 01:43:17 +00:00
- Download and install a module globally:
2015-12-30 04:46:40 +00:00
`npm install -g {{module_name}}`
2016-01-30 16:15:22 +00:00
- Download all dependencies referenced in package.json:
`npm install`
2016-05-05 15:13:29 +01:00
- Download a given dependency required for the application to run, and add it to the package.json:
2014-03-04 01:43:17 +00:00
`npm install {{module_name}}@{{version}} --save`
2016-05-05 15:13:29 +01:00
- Download a given dependency for development purposes, and add it to the package.json:
`npm install {{module_name}}@{{version}} --save-dev`
- Uninstall a module:
2014-03-04 01:43:17 +00:00
`npm uninstall {{module_name}}`
2014-03-04 01:43:17 +00:00
2017-11-23 06:11:06 +00:00
- List a tree of installed modules referenced in package.json:
2014-03-04 01:43:17 +00:00
`npm list`
2015-12-30 13:10:04 +00:00
- List top-level globally installed modules:
`npm list -g --depth={{0}}`
- Interactively create a package.json file:
2015-12-30 13:10:04 +00:00
`npm init`