Install Npm Packages Flashcards

1
Q

What command is used to install a package locally in npm?

A

npm install <package-name></package-name>

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

True or False: The command ‘npm install -g <package-name>' installs a package globally.</package-name>

A

True

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

What flag is used with npm install to save a package as a development dependency?

A

–save-dev

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

Fill in the blank: The command ‘npm install <package-name> --save-dev' adds the package to the \_\_\_\_\_\_\_\_ section of package.json.</package-name>

A

devDependencies

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

What does the ‘-g’ flag stand for in ‘npm install -g <package-name>'?</package-name>

A

global

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

Which command would you use to install a package globally and save it as a dev dependency?

A

npm install -g <package-name> --save-dev</package-name>

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

What is the default installation scope for npm packages if no flag is specified?

A

local

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

True or False: Using ‘npm install <package-name>' will add the package to the dependencies in package.json.</package-name>

A

True

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

What command can be used to install multiple packages at once?

A

npm install <package1> <package2> ...</package2></package1>

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

What does the command ‘npm install <package-name> --save' do?</package-name>

A

It saves the package as a dependency in package.json.

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

Fill in the blank: To uninstall a package, you would use the command ‘npm ________ <package-name>'.</package-name>

A

uninstall

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

What is the purpose of the package.json file in a Node.js project?

A

It manages project dependencies and scripts.

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

True or False: All npm packages can be installed globally.

A

False

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

What does the ‘–no-save’ flag do when installing an npm package?

A

It prevents the package from being added to package.json.

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

Which command would you use to install a specific version of a package?

A

npm install <package-name>@<version></version></package-name>

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

True or False: The command ‘npm install’ without any arguments installs all dependencies listed in package.json.

17
Q

What command would you use to check for outdated npm packages?

A

npm outdated

18
Q

What is the purpose of the ‘node_modules’ directory?

A

It stores all the installed npm packages for a project.

19
Q

Fill in the blank: The command ‘npm ________ <package-name>' updates a package to the latest version.</package-name>