The EUSAGE error occurs when you pass both --yes and --no flags to npx, which are mutually exclusive. Use only one flag: --yes to install without prompting, or --no to use only locally installed packages.
This error occurs when you pass both --yes (-y) and --no flags to npx. These flags are mutually exclusive because they represent opposite behaviors: - `--yes`: Automatically install and run packages without prompting - `--no`: Only use locally installed packages, never download from registry Using both simultaneously is contradictory, so npx rejects the command. This often happens in build scripts where flags are concatenated from multiple sources or environment variables.
Use either --yes or --no, not both:
# Install packages without prompting
npx --yes create-react-app my-app
# Use only locally installed packages
npx --no eslint .The flags are mutually exclusive by design.
Use --yes when:
- Running in CI/CD (no user to answer prompts)
- You want to always use the latest version
- First-time setup scripts
Use --no when:
- You want reproducible builds with local versions only
- Security-conscious environments
- Offline development
npm config can set --yes globally:
# Check if yes is set
npm config get yes
# Unset if needed
npm config delete yesOr check environment:
echo $npm_config_yesReview scripts that construct npx commands:
# Bad: concatenating flags that might conflict
NPX_FLAGS="--yes"
NPX_FLAGS="$NPX_FLAGS --no" # Oops!
npx $NPX_FLAGS create-app
# Good: use conditional logic
if [ "$CI" = "true" ]; then
npx --yes create-app
else
npx create-app
fiFor cross-version compatibility (npm 6 through 10+):
npm_config_yes=true npx create-react-app my-appThis works in CI environments and is ignored by npm versions that don't support --yes.
The --yes flag was introduced in npm 7. In npm 6, npx would always prompt or auto-install depending on context.
For CI/CD environments, the recommended patterns are:
GitHub Actions:
- run: npx --yes create-react-app my-appDocker:
RUN npm_config_yes=true npx create-react-app my-appIf you need to support both npm 6 and npm 7+, use the environment variable approach since --yes doesn't exist in npm 6.
The --no flag (or --no-install) is useful for ensuring you only run locally installed versions, which is important for security and reproducibility. However, it will fail if the package isn't already installed locally.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"