2014-03-04 01:43:17 +00:00
|
|
|
# npm
|
|
|
|
|
|
|
|
> Node package manager, to manage Node.js projects and install module dependencies.
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Create a new project in the current folder:
|
2014-03-04 01:43:17 +00:00
|
|
|
|
|
|
|
`npm init`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Download all dependencies referenced in package.json:
|
2014-03-04 01:43:17 +00:00
|
|
|
|
|
|
|
`npm install`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Download and install a module globally:
|
2015-12-30 04:46:40 +00:00
|
|
|
|
|
|
|
`npm install -g {{module_name}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Download a given dependency, and add it to the package.json:
|
2014-03-04 01:43:17 +00:00
|
|
|
|
|
|
|
`npm install {{module_name}}@{{version}} --save`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Set the version of the current project:
|
2014-03-04 01:43:17 +00:00
|
|
|
|
|
|
|
`npm version {{1.2.3}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Publish the current project:
|
2014-03-04 01:43:17 +00:00
|
|
|
|
|
|
|
`npm publish`
|
2015-12-30 13:10:04 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Cleanup packages (removes packages which are installed but are not listed in `package.json`):
|
2015-12-30 13:10:04 +00:00
|
|
|
|
|
|
|
`npm prune`
|