Skip to content
Latchkey

npm EUSAGE "Usage:" - Fix Invalid npm Command or Flags in CI

EUSAGE is npm telling you the command itself was used incorrectly - an unknown subcommand, a removed flag, or missing/extra arguments. It prints a usage block and exits before doing any work.

What this error means

An npm step fails with npm error code EUSAGE followed by a Usage: block for the command you ran. The arguments or flags you passed are not valid for this npm version.

npm output
npm error code EUSAGE
npm error
npm error Unknown command: "isntall"
npm error
npm error Usage: npm install [<package-spec> ...]

Common causes

Typo or unknown subcommand

A misspelled command (npm isntall) or a subcommand that does not exist produces EUSAGE with the correct usage.

A removed or renamed flag

A flag that existed in an older npm (or never existed) is rejected. For example, mixing up --omit=dev with old --only/--production forms.

How to fix it

Correct the command to match the usage block

Read the printed usage and fix the subcommand or flags.

Terminal
# wrong
npm isntall --only=prod
# right
npm install --omit=dev
# inspect valid flags
npm install --help

Align scripts with the installed npm

  1. Check the npm version (npm --version) the CI image ships.
  2. Replace deprecated/removed flags with their current equivalents.
  3. Run npm <command> --help to confirm the exact accepted syntax.

How to prevent it

  • Pin and know the npm version your CI uses.
  • Prefer current flags (--omit/--include) over legacy ones.
  • Lint CI scripts for stale npm invocations.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →