npm Introduction
npm is the package manager that ships with Node.js. A package manager is a tool that finds and installs code libraries.
Check the version
This command asks npm for its version. Run it in a terminal.
npm --versionGet help
This command lists what npm can do. Run it in a terminal.
npm --helpExample
npm --versionKey points
- npm ships with Node.js, so installing Node installs npm too.
- A package is a folder of reusable code that someone else wrote.
- npm finds packages in the npm registry.
- The npm registry is an online store of packages.
- npm installs a package with one command.
- A terminal is a window that takes typed commands.
- Run npm --version to see the installed npm version.
In this example, npm --version asks npm for its version number. The output 10.9.4 shows npm version 10.9.4 is installed. A version number tells which release of npm is on the machine.
Note
npm needs the internet to fetch packages, so install commands fail offline.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
What is npm?