1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/npm.md

32 lines
638 B
Markdown
Raw Normal View History

2014-03-04 12:43:17 +11:00
# npm
> Node package manager, to manage Node.js projects and install module dependencies.
- Create a new project in the current folder:
2014-03-04 12:43:17 +11:00
`npm init`
- Download all dependencies referenced in package.json:
2014-03-04 12:43:17 +11:00
`npm install`
- Download and install a module globally:
2015-12-29 22:46:40 -06:00
`npm install -g {{module_name}}`
- Download a given dependency, and add it to the package.json:
2014-03-04 12:43:17 +11:00
`npm install {{module_name}}@{{version}} --save`
- Set the version of the current project:
2014-03-04 12:43:17 +11:00
`npm version {{1.2.3}}`
- Publish the current project:
2014-03-04 12:43:17 +11:00
`npm publish`
2015-12-30 14:10:04 +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`