NPM Flashcards

1
Q

What is NPM?

A

NPM (Node Package Manager) is the world’s largest software registry, center of JavaScript code sharing

Consists of three distinct components:
the website - to discover packages, set up profiles, and manage other aspects of your npm experience,
the CLI - runs from a terminal and how most developers interact with npm, and
the registry - large public database of JavaScript software and the meta-information surrounding it.

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

What is a package?

A

Bits of reusable code; A directory which contains one or more files AND 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 apackage.jsonwithnpm?

A

npm init –yes

npm init -y

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

A dependency is a library that a project needs to function effectively.

npm install

In package.json file, there is an object calleddependenciesand it consists of all the packages that are used in the project with its version number. So, whenever you install any library that is required in your project that library you can find it in the dependencies object.

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 withnpm?

A

Install the dependencies to the localnode_modulesfolder. By default,’npm install’will install all modules listed in the dependencies property inpackage.json file.

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