The npm Registry
npm comes as two primary tools:
- A command-line tool with abilities that include installing and uninstalling packages.
- An online registry of all packages registered with npm.
On the npm registry, all public packages can be searched and reviewed before installation. Most packages come with a
README.md file with instructions for installation and usage.
As a command-line tool, npm comes with a litany of commands for working with packages. One of the most common npm commands is:
npm install <package-name-here>
npm i <package-name-here>works, too.
npm install with no specific package will (re)install all the packages for the project.
The following command can be run to get a brief overview of common npm commands:
npm -hworks, too.
Alternatively, a (long) list of all npm commands, paired with brief descriptions, can be viewed with the
npm also features the ability to install packages globally, so packages can be used as command-line tools anywhere. This is done with the
npm install -g <package-name-here>
npx executes packages anywhere without having to handle installation. It uses the following syntax:
npx [options] <command>[@version] [command-arg]
For example, the following command would be used to execute the
codecademy package with the arguments:
npx codecademy "Hello world!"
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.