Skip to content

Investigate: npm publish warning strips bin entry from published package #11

@gurvinder-dhillon

Description

@gurvinder-dhillon

Problem

Every npm publish run emits the following warning:

npm warn publish npm auto-corrected some errors in your package.json when publishing.
npm warn publish errors corrected:
npm warn publish "bin[openqa]" script name src/cli/bin.js was invalid and removed

The warning says npm removed the bin entry from the published package. If this is actually happening (not just a cosmetic warning), then npx openqa init would silently fail for users who install the package — the CLI command wouldn't be registered.

Current package.json bin config

"bin": {
  "openqa": "./src/cli/bin.js"
}

src/cli/bin.js has the correct shebang (#!/usr/bin/env node) and is marked executable (-rwxr-xr-x).

What to investigate

  1. Verify the CLI works post-install: Run npm install openqa@0.0.7 in a fresh temp directory and confirm npx openqa (or ./node_modules/.bin/openqa) is available and runnable.

  2. Check if the bin entry is in the published tarball: Run npm pack --dry-run and then tar -tzf openqa-0.0.7.tgz to see if package.json inside the tarball contains the bin field.

  3. Run npm pkg fix: npm specifically recommends this. Run it and see what it changes — it may reveal the exact validation failure.

  4. Check npm's bin validation rules: npm validates that bin script values are relative paths within the package and that the key (command name) is a valid executable name. The key "openqa" is valid; the value "./src/cli/bin.js" should also be valid. But npm might be rejecting it for a non-obvious reason (e.g. .js extension handling on Windows, or a validation change in a recent npm version).

References

Priority

Medium — the warning has been present since at least v0.0.6. The CLI likely still works (npm may apply the fix silently before publishing while keeping the bin in the tarball), but this needs to be confirmed and the root cause understood.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions