Skip to content

Wireit fails when invoked via node --run #1094

Closed
@justinfagnani

Description

@justinfagnani

node --run <npm-script> is a new command in Node 22 that runs scripts defined in package.json, but has much less overhead (~200ms less) than npm run: nodejs/node#52190

It should be very nice paired with Wireit for cached scripts.

But Wireit currently throws:

❌ wireit must be launched with "npm run" or a compatible command.
    More info: Wireit could not identify the script to run.
node:child_process:965
    throw err;
    ^

Error: Command failed: wireit
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at node:internal/main/run:74:1 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 62461,
  stdout: null,
  stderr: null
}

Node.js v22.0.0

It seems like npm --run isn't setting npm_lifecycle_event, so that (or a detectable alternative) would need to be fixed on their end. Hopefully that's it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions