An NPM Primer

A brief overview of the Node Package Manager (NPM).

What is NPM?

It’s probably best that we look at the Node Package Manager (NPM) and understand how it relates to Ionic development, as we’re going to be spending time dipping in and out of using this package manager throughout this course.

As the name implies, NPM is a package manager which allows developers to source self-contained modules, or packages, of JavaScript code that have been specifically developed to solve particular tasks (generating code documentation from inline comments or image compression for example) from an official online registry.

Why NPM?

This is particularly useful for developers, as the NPM registry provides high-quality, pre-existing solutions, built to an agreed standard that can be quickly and easily integrated into projects where required.

It’s helpful to not have to invent solutions when they already exist. With the NPM registry, the chances are very high that, should we require a pre-existing solution for a particular task, we’ll be able to find it there.

Searching for packages

As for sourcing packages, this can be done through browsing the registry directly at npmjs.com or via the CLI using the following command:

npm search <name of package here>

Pretty straightforward right?

So, if we wanted to search for available In-App Purchase plugins, for example, we could type the following command in the Terminal or Command Prompt:

npm search In-App Purchase

Note: Try running this command in the terminal provided below!

Get hands-on with 1200+ tech skills courses.