Welcome to the Linux Foundation Forum!

Knowledge Check: Question 6.3

If a package dependency has a development dependency, in what scenario, if any, will the development dependency be installed?

A. When running npm install inside the package folder
B. Never
C. When running npm install --production inside the package folder

Why is the correct answer B. Never?

When I run npm install both prod and dev dependencies are installed.
In order to avoid dev dependencies I should run npm install --production or npm install --omit=dev.
So it seems the correct answer is A instead.

After all, what is the purpose of dev dependencies if there is no way to install them?

Regards,
Dmytro

249ymzn0nkk5-LFW211Labs06.28.2023.pdf

Best Answer

  • xdxmxc
    xdxmxc Posts: 157
    edited November 2023 Answer ✓

    @dmsheiko "if a package DEPENDENCY has a development dependency" vs "if a package has a development dependency" - i.e. it's a second level dev dep. Second level dev deps are never installed.

Answers

  • Got it, thanks. Did not notice that it's about second level dependency.

  • xdxmxc
    xdxmxc Posts: 157

    yeah it's often missed in real world development, that's why it's one of the questions

Categories

Upcoming Training