0
0
Node.jsframework~5 mins

Installing packages (dependencies vs devDependencies) in Node.js - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What is the difference between dependencies and devDependencies in a Node.js project?

dependencies are packages needed for the app to run in production.<br>devDependencies are packages only needed during development, like testing or building tools.

Click to reveal answer
beginner
Which command installs a package as a devDependency using npm?

Use npm install <package> --save-dev or the shortcut npm i <package> -D.

Click to reveal answer
intermediate
Why should you separate dependencies and devDependencies?

Separating helps keep production installs small and fast by only installing what the app needs to run.<br>It also avoids shipping unnecessary tools to users.

Click to reveal answer
intermediate
What happens if you run npm install in production mode?

Only dependencies are installed, skipping devDependencies to save space and time.

Click to reveal answer
beginner
How can you check which packages are listed as dependencies or devDependencies?

Look inside the package.json file under the dependencies and devDependencies sections.

Click to reveal answer
Which npm command installs a package as a regular dependency?
Anpm install express
Bnpm install express --save-dev
Cnpm install express -D
Dnpm uninstall express
Where are devDependencies listed in a Node.js project?
AIn the <code>node_modules</code> folder only
BIn the <code>package.json</code> file under <code>devDependencies</code>
CIn the <code>package-lock.json</code> file
DIn the <code>README.md</code> file
What is the main reason to use devDependencies?
ATo update packages automatically
BTo include packages needed in production
CTo include packages only needed during development
DTo uninstall packages
If you run npm install --production, what happens?
AOnly <code>dependencies</code> are installed
BOnly <code>devDependencies</code> are installed
CBoth <code>dependencies</code> and <code>devDependencies</code> are installed
DNo packages are installed
Which of these is NOT a devDependency?
AA code linter like ESLint
BA bundler like Webpack
CA testing library like Jest
DA runtime framework like Express
Explain the difference between dependencies and devDependencies in a Node.js project and why it matters.
Think about what packages your app needs when running versus when building or testing.
You got /4 concepts.
    Describe how you would install a package only for development and how to check it in your project files.
    Focus on the npm command and where the info is stored.
    You got /3 concepts.