Welcome to the Linux Foundation Forum!

Knowledge Check: Question 6.3

Options

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: 148
    edited November 2023 Answer ✓
    Options

    @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

  • dmsheiko
    Options

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

  • xdxmxc
    xdxmxc Posts: 148
    Options

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

Categories

Upcoming Training