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