hnvm icon indicating copy to clipboard operation
hnvm copied to clipboard

Package postinstall step fails when spawning new node process

Open TrevorBurnham opened this issue 2 years ago • 2 comments

Output when running ./pnpm install in a project with [email protected]:

node_modules/.pnpm/[email protected]/node_modules/core-js-pure: Running postinstall script, failed in 935ms
.../node_modules/core-js-pure postinstall$ node -e "try{require('./postinstall')}catch(e){}"
│ No HNVM_NODE version set. Please set a Node version.
└─ Failed in 936ms

The error occurs when the package is running this postinstall step defined in its package.json.

TrevorBurnham avatar Dec 10 '21 17:12 TrevorBurnham

original report in slack: https://compass-tech.slack.com/archives/CBN9MNRHD/p1639153650353500

SpencerWhitehead7 avatar Dec 10 '21 17:12 SpencerWhitehead7

Per discussion in that thread, this issue is only occurring with pnpm >= 6.23.0, which made this change:

The path to the node executable that executes pnpm should not be added to the PATH, when running scripts.

Adding scripts-prepend-node-path=true to the project's .npmrc restores the more hnvm-friendly behavior that we had with older pnpm versions.

TrevorBurnham avatar Dec 10 '21 17:12 TrevorBurnham