-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI/CD runs fail: Type Error: URL.canParse is not a function #474
Comments
The weird part is, the failure happens after the tasks where corepack is doing its thing. This is my pipeline script: pool:
vmImage: ubuntu-latest
variables:
pnpm_config_cache: $(Pipeline.Workspace)/.pnpm-store
steps:
- task: UseNode@1
inputs:
version: "20.x"
displayName: "Install Node.js"
- task: Cache@2
inputs:
key: 'pnpm | "$(Agent.OS)" | ./src/ui/pnpm-lock.yaml'
path: $(pnpm_config_cache)
displayName: Cache pnpm
- script: |
corepack enable
corepack prepare pnpm@latest-8 --activate
displayName: "Setup pnpm"
- script: pnpm config set store-dir $(pnpm_config_cache)
displayName: "Setup pnpm caching"
- script: |
cd src/ui
pnpm install
displayName: "Install PNPM packages"
- script: |
node -v
pnpm -v
cd src/ui
pnpm fastbuild
displayName: "Build UI" The "setup pnpm" step runs perfectly. The failure happens during the "build UI" step. |
I may be wrong about this. As an experiment, I removed Corepack from the equation. After doing that, PNPM started giving me an error that I was only using node v16, despite explicitly installing v20 earlier in the pipeline. Once I find a solution to that problem I'll update this issue. |
Yep, never mind, it was a problem with my own setup using a different node version. |
I'd love to know how you solved this as I have the same problem. I'm not using pnpm; just yarn. Here's my Github actions workflow:
|
|
ok, that makes sense. In my workflow the error was coming from Solution is to move Removing |
URL.canParse is in v18 too https://nodejs.org/docs/latest-v18.x/api/url.html |
I'm not sure exactly when or how this issue started. But all my CI/CD runs using CorePack and PNPM are currently failing:
Type Error: URL.canParse is not a function at parseSpec (/opt/hostedtoolcache/node/20.12.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:23627:21) at loadSpec (/opt/hostedtoolcache/node/20.12.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:23704:11) at async findProjectSpec (/opt/hostedtoolcache/node/20.12.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:23649:20) at async executePackageManagerRequest (/opt/hostedtoolcache/node/20.12.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:24223:18) at async BinaryCommand.validateAndExecute (/opt/hostedtoolcache/node/20.12.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:21173:22) at async _Cli.run (/opt/hostedtoolcache/node/20.12.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:22148:18) at async Object.runMain (/opt/hostedtoolcache/node/20.12.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:24279:12) ELIFECYCLE Command failed with exit code 1.
Prior issues with this error (e.g. #394, #450) have been the result of using an older version of Node. However I'm running v20.12.2 and have tried v22 as well - the error happens either way.
The text was updated successfully, but these errors were encountered: