Description:
This repo can be used to reproduce an issue "Type Error: URL.canParse is not a function" encountered specifically when using pnpm from within npm scripts executed using pnpm. This occurs when using corepack to install the package manager for the project (corepack enable) and pnpm node settings via use-node-version.
Steps to Reproduce:
- Install corepack using brew
brew install corepack. - Use corepack to install the package manager for this project
corepack enable. - Run
pnpm test(this works). - Run
pnpm test:a(this fails with the error).
Observed Behavior:
pnpm -vexecuted directly works successfully.pnpm pnpm -v(invokingpnpmfrom an npm script) results in the error.
Expected Behavior:
- Both commands should run successfully, pnpm CLI itselft should always be executed with the node version specified by the corepack brew formula.
Suspected Cause:
- Potentially incorrect Node.js version inheritance when invoking
pnpmfrom within an npm script. - Possible conflict between corepack's Node.js dependency and
use-node-versionwithin nestedpnpmcalls.
Additional Information:
- Corepack brew formula version: 0.25.2
- Global pnpm version (installed by corepack brew formula): 7.14.1
- Project pnpm version: 8.15.4
