NPM Flashcards
What is NPM?
npm is the world’s largest software registry
A way to reuse code from other developers, and share your code with other developers on the registry
npm consists of three distinct components:
the website
the Command Line Interface (CLI)
the registry
What is a package?
A directory with one or more files in it that also has a file called package.json with some metadata about this package
How can you create a package.json with npm?
- Navigate to the root directory of your package first
- Run the command ‘npm init’
What is a dependency and how to you add one to a package?
Dependencies are packages or libraries that your application depends on to function.
You can add it using the command line
npm install [package]
What happens when you add a dependency to a package with npm?
The dependencies in your project’s package.json allow the project to install the versions of the modules it depends on. By running an install command inside a project, you can install all of the dependencies listed in the project’s package.