Tools hardcoded to run scripts with npm fail when using corepack-managed npm
This worked when using node-managed npm. Ideally I would be able to use npm test and npm run and such but not npm install when a package has packageManager set.
$ npm test
Usage Error: This project is configured to use pnpm
Try with export COREPACK_ENABLE_STRICT=0
this flag seems not working, I'm running with node v20.11.0 and corepack v0.10.0.
my issue is some dependency is running a post install script and using npm to run some command:
update:
this is resolved by upgrade better-sqlite3 to the latest version. I think this error message is a bit misleading, it's actually the postinstall script that failed because the version of better-sqlite3 we depend on is too old to find a pre-built binary that matches the current node version, and the post-install compilation is failing. Not an issue with npm itself.
I made a tool that fixes this https://www.npmjs.com/package/npm-run-shim
@antfu/ni will pick the correct package manager for all the package operations.
npx --package @antfu/ni nr ...