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
Managor 320d209c78
*: fix style guide issues part 2 (#15777)
Co-authored-by: Darío Hereñú <magallania@gmail.com>
2025-03-07 13:45:30 +02:00

37 lines
1 KiB
Markdown

# npm
> JavaScript and Node.js package manager.
> Manage Node.js projects and their module dependencies.
> More information: <https://www.npmjs.com>.
- Create a `package.json` file with default values (omit `--yes` to do it interactively):
`npm init {{[-y|--yes]}}`
- Download all the packages listed as dependencies in `package.json`:
`npm install`
- Download a specific version of a package and add it to the list of dependencies in `package.json`:
`npm install {{package_name}}@{{version}}`
- Download the latest version of a package and add it to the list of dev dependencies in `package.json`:
`npm install {{package_name}} {{[-D|--save-dev]}}`
- Download the latest version of a package and install it globally:
`npm install {{[-g|--global]}} {{package_name}}`
- Uninstall a package and remove it from the list of dependencies in `package.json`:
`npm uninstall {{package_name}}`
- List all locally installed dependencies:
`npm list`
- List all top-level globally installed packages:
`npm list {{[-g|--global]}} --depth {{0}}`