Skip to main content

What it flags

A RUN npm install or RUN npm i (shell form, exec form, or a line of a RUN <<EOF heredoc), with only flags, redirections (> /dev/null, 2>&1) and an optional shell comment after it (options that take a separate value, such as --registry <url>, --omit dev or --tag next, count as flags), npm options allowed before the subcommand (npm --prefix /app install), optionally after NAME=value assignments (quoted values may contain spaces), an if, while, until, then, do or else keyword, a ! negation, or inside sh -c "..." (also bash, dash, ash and zsh, and combined flags such as bash -lc), in a stage that has already copied package-lock.json or npm-shrinkwrap.json by name (or builds FROM an earlier stage that did), or that bind-mounts the lockfile into the same RUN. The package*.json glob counts only when a package-lock.json sits beside the Dockerfile (the glob does not match npm-shrinkwrap.json). When package.json and the lockfile disagree, npm install resolves other versions and rewrites the lockfile instead of failing. npm ci installs exactly the locked tree and is usually faster in a clean image. Not flagged: text that is only printed or quoted (echo "cd app && npm install"), npm ci, installing named packages (npm install -g pnpm), npm install --no-package-lock, --package-lock=false or --package-lock-only (before or after the subcommand), a stage that copied only package.json, the package*.json glob with no lockfile beside the Dockerfile, and COPY . . (the rule cannot tell whether the build context has a lockfile). The build context is set outside the Dockerfile (docker build <dir>, a compose context:), so the glob is judged against the Dockerfile’s own folder. Yarn and pnpm installs are not checked.

Configuration

Set the rule to "off" in loadwise.config.json to drop its findings: