1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-10-31 04:17:55 +01:00
tldr/pages/common/npm.md

38 lines
896 B
Markdown
Raw Normal View History

2014-03-04 02:43:17 +01:00
# npm
> JavaScript and Node.js package manager.
> Manage Node.js projects and their module dependencies.
> More information: <https://www.npmjs.com/>.
2014-03-04 02:43:17 +01:00
- Interactively create a package.json file:
2015-12-30 05:46:40 +01:00
`npm init`
2015-12-30 05:46:40 +01:00
- Download all the packages listed as dependencies in package.json:
2016-01-30 17:15:22 +01:00
`npm install`
- Download a specific version of a package and add it to the list of dependencies in package.json:
`npm install {{module_name}}@{{version}}`
- Download a package and add it to the list of dev dependencies in package.json:
2014-03-04 02:43:17 +01:00
`npm install {{module_name}} --save-dev`
2014-03-04 02:43:17 +01:00
- Download a package and install it globally:
`npm install -g {{module_name}}`
- Uninstall a package and remove it from the list of dependencies in package.json:
2014-03-04 02:43:17 +01:00
`npm uninstall {{module_name}}`
2014-03-04 02:43:17 +01:00
2019-03-12 17:05:35 +01:00
- Print a tree of locally-installed dependencies:
2014-03-04 02:43:17 +01:00
`npm list`
2015-12-30 14:10:04 +01:00
- List top-level globally installed modules:
`npm list -g --depth={{0}}`