NPM Flashcards

1
Q

What is NPM?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a package?

A

A directory with one or more files in it that also has a file called package.json with some metadata about this package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you create a package.json with npm?

A
  1. Navigate to the root directory of your package first
  2. Run the command ‘npm init’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a dependency and how to you add one to a package?

A

Dependencies are packages or libraries that your application depends on to function.

You can add it using the command line

npm install [package]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What happens when you add a dependency to a package with npm?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly