1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 00:22:09 +02:00
tldr/pages/common/npm.md
Nicolas Kosinski fcab942a24
npm: favor 'package' over 'module' (#10924)
As I understand the documentation, 'module' is more specific:
https://docs.npmjs.com/about-packages-and-modules

Note that the 'package' term is used in CLI help:

	$ npm install --help
	Install a package

	Usage:
	npm install [<package-spec> ...]
2023-10-11 09:33:22 +02:00

964 B

npm

JavaScript and Node.js package manager. Manage Node.js projects and their module dependencies. More information: https://www.npmjs.com.

  • Interactively create a package.json file:

npm init

  • 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}} --save-dev

  • Download the latest version of a package and install it globally:

npm install --global {{package_name}}

  • Uninstall a package and remove it from the list of dependencies in package.json:

npm uninstall {{package_name}}

  • Print a tree of locally installed dependencies:

npm list

  • List top-level globally installed packages:

npm list --global --depth={{0}}