NPM Flashcards

1
Q

What is NPM?

A

It is the world’s largest software registry, developers use npm to share software

It’s a way to share code with other developers

Consists of 3 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

Reusable Code

A directory with one or more files in it that also has a package.json with some metadata about the 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

Run the commands:

cd /path/to/package

npm init -y —–or—– npm init –yes

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

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

A

A dependency is packages required by your application in production

You can edit your package.json manually or use the command while in your specified directory

npm install

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

It adds a folder and updates your package.json with a dependency key value

“dependencies:” {
“jquery”: “^3.6.0”
}

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