Description
I tried running np on a fresh repo pull (no npm install yet) and it failed because I had a pack npm script.
Note that this is an uncaught error from an internal np command, not during the final pack phase.
The strange part is that np already calls npm pack with --foreground-scripts=false
❯ np
✖ ExecaError: Command failed with exit code 2: npm pack --dry-run --json --silent '--foreground-scripts=false'
{
"error": {
"code": 2,
"summary": "command failed",
"detail": "sh -c tsc --sourceMap false\nerror TS2318: Cannot find global type 'Array'.\nerror TS2318: Cannot find global type 'Boolean'.\nerror TS2318:
Steps to reproduce
On any repo:
npm pkg set scripts.pack='exit 1'
np
Expected behavior
It's not clear what the behavior should be. I think np is calling pack to get the list of "new files", but when it does so it expects the repo to be prepped in some way (npm pack should already work).
Given that np runs npm install internally, I'd think it wouldn't need npm install also before running.
Possible fixes
- make sure npm scripts do not run during this phase
- catch and handle the error properly
Environment
np - 11.0.2
Node.js - 22.18.0.
npm - 10.9.3
Git - 2.39.5 (Apple Git-154)
OS - macOS 15.7.3
Description
I tried running
npon a fresh repo pull (nonpm installyet) and it failed because I had apacknpm script.Note that this is an uncaught error from an internal np command, not during the final
packphase.The strange part is that np already calls
npm packwith--foreground-scripts=falseSteps to reproduce
On any repo:
npm pkg set scripts.pack='exit 1'npExpected behavior
It's not clear what the behavior should be. I think np is calling
packto get the list of "new files", but when it does so it expects the repo to be prepped in some way (npm packshould already work).Given that np runs
npm installinternally, I'd think it wouldn't neednpm installalso before running.Possible fixes
Environment
np - 11.0.2
Node.js - 22.18.0.
npm - 10.9.3
Git - 2.39.5 (Apple Git-154)
OS - macOS 15.7.3