2014-03-04 02:43:17 +01:00
|
|
|
# npm
|
|
|
|
|
2016-01-30 14:04:30 +01:00
|
|
|
> JavaScript and Node.js package manager.
|
|
|
|
> Manage Node.js projects and their module dependencies.
|
2014-03-04 02:43:17 +01:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Download and install a module globally:
|
2015-12-30 05:46:40 +01:00
|
|
|
|
|
|
|
`npm install -g {{module_name}}`
|
|
|
|
|
2016-01-30 17:15:22 +01:00
|
|
|
- Download all dependencies referenced in package.json:
|
|
|
|
|
|
|
|
`npm install`
|
|
|
|
|
2016-05-04 10:46:42 +02:00
|
|
|
- Download a given dependency, and add it to the package.json (as `dependencies`):
|
2014-03-04 02:43:17 +01:00
|
|
|
|
|
|
|
`npm install {{module_name}}@{{version}} --save`
|
|
|
|
|
2016-05-04 10:46:42 +02:00
|
|
|
- Download a given dependency, and add it to the package.json (as `devDependencies`):
|
|
|
|
|
|
|
|
`npm install {{module_name}}@{{version}} --save-dev`
|
|
|
|
|
2016-01-30 14:04:30 +01:00
|
|
|
- Uninstall a module:
|
2014-03-04 02:43:17 +01:00
|
|
|
|
2016-01-30 14:04:30 +01:00
|
|
|
`npm uninstall {{module_name}}`
|
2014-03-04 02:43:17 +01:00
|
|
|
|
2016-01-30 14:04:30 +01:00
|
|
|
- List a tree of installed modules:
|
2014-03-04 02:43:17 +01:00
|
|
|
|
2016-01-30 14:04:30 +01:00
|
|
|
`npm list`
|
2015-12-30 14:10:04 +01:00
|
|
|
|
2016-01-30 14:04:30 +01:00
|
|
|
- Interactively create a package.json file:
|
2015-12-30 14:10:04 +01:00
|
|
|
|
2016-01-30 14:04:30 +01:00
|
|
|
`npm init`
|