nodejs / nodejs/corepack

Unhandled Exception leading to Ambiguous and Unhelpful 404 Error | Corepack

Open
#204 3 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

Version

v18.12.0

Platform

Darwin MBPM1-OP-43 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64

Subsystem

corepack

What steps will reproduce the bug?

Open Existing node project

Add "packageManager": "pnpm@7.13.14", to package.json

Run in terminal
rm -rf node_modules
corepack enable
corepack prepare pnpm@latest --activate
pnpm install or pnpm version

How often does it reproduce? Is there a required condition?

Anytime invalid package version used for PNPM

What is the expected behavior?

Handle Error with helpful response.
e.g.

Invalid Package.Json:112 config for packageManager.
Requested pnpm version 7.13.14 is invalid
"packageManager": "pnpm@7.13.14",

What do you see instead?

Unhandled, Ambiguous and Unhelpful Error.

Internal Error: Server answered with HTTP 404
    at ClientRequest.<anonymous> (/Users/jeremiah.snee/.asdf/installs/nodejs/18.12.0/lib/node_modules/corepack/dist/corepack.js:16060:31)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:513:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)
    at TLSSocket.socketOnData (node:_http_client:534:22)
    at TLSSocket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10) 
Additional information

Simple Fix.

Check https://registry.npmjs.org/pnpm for valid matching version before creating http request.

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

Reproduce the issue with package.json and the listed corepack and pnpm commands, then trace the Corepack path that handles the requested package-manager version and the HTTP 404. Done means invalid versions produce a specific, helpful validation error instead of an unhandled ambiguous response.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.