When scanning a Node.js project with WhiteSource Bolt, you want only production dependencies scanned so development-only libraries are excluded. Which npm command should you run to ensure production dependencies are installed?
Choose an answer
Tap an option to check your answer.
Correct answer: npm install.
Why this is the answer
The npm install command, when run without any specific package names, installs all dependencies listed in package.json. By default, it installs both dependencies (production) and devDependencies (development-only). To install only production dependencies, you would typically use npm install --production. However, if npm install is run in an environment where the NODEENV environment variable is set to production, it will automatically behave as if --production was passed, installing only production dependencies. This is the standard way to prepare a Node.js project for deployment or scanning where development tools are not needed. npm edit opens an installed package in your default editor, which is unrelated to dependency installation. npm publish publishes a package to the npm registry, not for installing dependencies. npm update updates existing packages to their latest versions, but it doesn't control the scope (production vs. development) of the initial installation in the same way as npm install --production or npm install in a production environment.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed