nodejs / nodejs/corepack

`parseURL` failed when installing pnpm

Open
#559 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.8k
Forks
279
Avg merge
1h 47m
Merged PRs (30d)
2

Description

I'm using Node.js v20.17.0, and I am having problem when installing pnpm by corepack use pnpm@latest.
Corepack throw a parseURL immediately.

Invalid Argument Error: Invalid URL protocol: the URL must start with `http:` or `https:`.
    at parseURL (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:3698:15)
    at Object.parseOrigin (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:3703:13)
    at new Pool (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:11633:27)
    at defaultFactory (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:11773:14)
    at new ProxyAgent2 (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:11803:25)
    at getProxyAgent (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:21662:10)
    at async fetch (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:21582:17)
    at async fetchAsJson (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:21623:20)
    at async fetchAvailableTags (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:21563:20)
    at async fetchAvailableTags2 (/Users/maxtune/.nvm/versions/node/v20.17.0/lib/node_modules/corepack/dist/lib/corepack.cjs:21686:14)

I tried to change to another device or downgrade node to 18.20.4 and still having the same issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at parseURL in the generated corepack.cjs path shown in the stack trace and follow how the ProxyAgent receives its URL. Reproduce with corepack use pnpm@latest and compare the value reaching parseURL; add coverage for the failing installation path, with done defined as the command proceeding without the Invalid URL protocol error.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.