Skip to content

fix(npm): postinstall exits 0 on download failure, masking install #26

@btwshivam

Description

@btwshivam

when the binary download fails (network down, 404, timeout), postinstall.js logs the error and exits with code 0:

// npm/postinstall.js:76-80
console.error('optiqor: failed to install binary:', err.message);
console.error('optiqor: this is non-fatal — build from source if needed:');
console.error('  go install github.com/optiqor/optiqor-cli/cmd/optiqor@latest');
...
process.exit(0);

npm install -g @optiqor/cli then reports success while no binary was actually installed. the user runs optiqor later, hits the "binary not found" branch in npm/index.js:11, and has no signal that the install was the cause.

current behavior trades a clear error for silent corruption. wrong default for a CLI tool. two options:

  1. process.exit(1) so npm reports the install as failed and the user sees it immediately
  2. drop a stub at vendor/optiqor that prints the build-from-source message when invoked, so optiqor always runs and the error surface stays consistent

option 1 is a one-line change. option 2 is a few lines but cleaner UX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/npmnpm distribution and wrapperbugSomething isn't workinggood first issueGood for newcomerssize/S11–50 lines

    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