Package Manager
Being able to make modules is great, but ultimately having a good way to
distribute them and share them with the rest of your team or the community
is essential. The package manager for Node, npm,
provides a way of distributing code, either locally or via a global
repository of Node modules. npm helps you manage code
dependencies, installation, and other things associated with distributing
code. Best of all, npm is all JavaScript and Node. So
if you are already using Node, you are ready to use
npm, too. npm provides both the
installation tools for developers and the distribution tools for package
maintainers.
Most developers will start by using npm to
install packages using the simple npm
install command. You can install packages you have locally, but
you’ll probably want to use npm to install remote
packages from the npm registry. The registry stores
packages that other Node developers make available to you to use. There
are many packages in the registry: everything from database drivers to
flow control libraries to math libraries. Most things you’ll install with
npm are 100% JavaScript, but a few of them require
compilation. Luckily, npm will do that for you. You can
see what’s in the registry at http://search.npmjs.org.
Searching Packages
The search command lists all packages in the global npm
registry and filters for a package name:
npm search packagenameIf you don’t supply a package name, all of the available packages will be displayed.
If the package list is out ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access