[BUG] `npm explain` on repo with large # of packages fails with `invalid string length`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
In a monorepo with a large number of packages in an npm workspace, the npm explain command fails to return.
Expected Behavior
A more useful error should be returned, or the output format of npm explain should be amended to make the output smaller and more useful.
For the other corepack package managers:
yarn whyreturns a compact output and succeedspnpm whycrashes with heap out of memory errors
Steps To Reproduce
- In my reproduction repository: https://github.com/forivall/npm-explain-invalid-string-length-repro
- Run
npm explain yargsornpm explain yargs --json - See the error
npm ERR! Invalid string length- or, with
--json, we seenpm ERR! Invalid string length { "error": { "code": null, "summary": "Invalid string length", "detail": "" } }
- or, with
Environment
- npm: 8.19.4
- Node.js: v16.17.0
- OS Name: macOS 13.3.1
- System Model Name: Macbook Pro
- npm config:
; "user" config from /Users/emily.klassen/.npmrc
//registry.npmjs.org/:_authToken = (protected)
email = "forivall@gmail.com"
init-author-name = "emily"
legacy-peer-deps = true
; node bin location = /Users/emily.klassen/.nvm/versions/node/v16.17.0/bin/node
; node version = v16.17.0
; npm local prefix = /Users/emily.klassen/code/public/npm-explain-invalid-string-length-repro
; npm version = 8.19.4
; cwd = /Users/emily.klassen/code/public/npm-explain-invalid-string-length-repro
; HOME = /Users/emily.klassen
; Run `npm config ls -l` to show all defaults.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure in the linked npm-explain-invalid-string-length-repro repository with npm explain yargs and npm explain yargs --json. Trace the npm explain CLI path involved in producing the oversized output. Done means the command no longer fails with Invalid string length and returns either a useful error or smaller, more useful output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100