Invalid string length
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- nodejs, powershell, typescript
- Domain
- devtools
Research direction
Start by reproducing pnpx node-modules-inspector under Windows PowerShell, then trace the pnpm ls JSON parsing path from the json-parse-stream.mjs stack-trace entry. Done means the inspector completes startup and reads node_modules without the “Invalid string length” crash in this environment.
Written by the indexing model from the issue text.
Description
Describe the bug
Just tried to run this first time using Windows + Powershell and got this error:
❯ pnpx node-modules-inspector
Packages: +68
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 68, reused 0, downloaded 68, added 68, done
⬢ Starting Node Modules Inspector at http://localhost:9999
⬢ Reading node_modules...
✔ Websocket client connected
Failed to parse JSON output from pnpm ls
{ error: { code: 'pnpm', message: 'Invalid string length' } }
file:///C:/Users/pegak/AppData/Local/pnpm-cache/dlx/b81ca73f0f9090324044485603825baafdaf6c1b1593cfb9acb9a8667c8a737f/196836a97ac-5cf4/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/chunks/json-parse-stream.mjs:855
throw new JsonParseStreamError(`Failed to parse JSON output from ${sourceName}`, assembler.current);
^
JsonParseStreamError: Failed to parse JSON output from pnpm ls
at Parser.<anonymous> (file:///C:/Users/pegak/AppData/Local/pnpm-cache/dlx/b81ca73f0f9090324044485603825baafdaf6c1b1593cfb9acb9a8667c8a737f/196836a97ac-5cf4/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/chunks/json-parse-stream.mjs:855:17)
at Parser.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushObjectMode (node:internal/streams/readable:538:3)
at Readable.push (node:internal/streams/readable:393:5)
at Parser._processBuffer (file:///C:/Users/pegak/AppData/Local/pnpm-cache/dlx/b81ca73f0f9090324044485603825baafdaf6c1b1593cfb9acb9a8667c8a737f/196836a97ac-5cf4/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/chunks/json-parse-stream.mjs:383:19)
at Parser._transformBuffer (file:///C:/Users/pegak/AppData/Local/pnpm-cache/dlx/b81ca73f0f9090324044485603825baafdaf6c1b1593cfb9acb9a8667c8a737f/196836a97ac-5cf4/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/chunks/json-parse-stream.mjs:37:11)
at Parser._transform (file:///C:/Users/pegak/AppData/Local/pnpm-cache/dlx/b81ca73f0f9090324044485603825baafdaf6c1b1593cfb9acb9a8667c8a737f/196836a97ac-5cf4/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/chunks/json-parse-stream.mjs:32:11)
at Transform._write (node:internal/streams/transform:171:8)
at writeOrBuffer (node:internal/streams/writable:572:12) {
data: { error: { code: 'pnpm', message: 'Invalid string length' } }
}
Node.js v22.14.0
Reproduction
- Use Windows + Powershell
- Run
pnpx node-modules-inspectorin any repository - Observe crash.
System Info
System:
OS: Windows 11 10.0.26120
CPU: (16) x64 AMD Ryzen 7 6800HS with Radeon Graphics
Memory: 14.09 GB / 31.26 GB
Binaries:
Node: 22.14.0 - ~\.proto\shims\node.EXE
npm: 10.9.1 - ~\.proto\shims\npm.EXE
pnpm: 10.8.1 - ~\.proto\shims\pnpm.EXE
bun: 1.2.10 - ~\.proto\shims\bun.EXE
Browsers:
Edge: Chromium (133.0.3065.10)
Internet Explorer: 11.0.26100.1
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
Contributions
- I am willing to submit a PR to fix this issue
- I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 91
- Avg merge
- 7h 11m
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from antfu/node-modules-inspector
-
Support bun dedupePossibly taken @MichielTondeur claimed this 21 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
antfu/node-modules-inspector#214 ·
-
Multiple Versions page shows incorrect 'npm-registry dedupe' commandPossibly taken @kael-wq claimed this 21 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 65/100
antfu/node-modules-inspector#213 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 38/100
antfu/node-modules-inspector#174 · 1 reaction ·
-
Fails to detect MIT license in require-like packagePossibly taken @clanzhang claimed this 39 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
antfu/node-modules-inspector#145 ·
-
Redundant codePossibly taken @clanzhang claimed this 35 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
antfu/node-modules-inspector#123 · 2 comments ·
All issues in antfu/node-modules-inspector
Similar issues
-
Endpoint links in the tag operations list are below the 24px target sizePossibly taken @AdzerKI claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
ai-driven-qa bug Minor
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
linagora/twake-tasks#435 ·
Maintainers usually reply within 1 day
-
bug domain: database priority: p1 Stellar Wave
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
StellarState/SS-backend#632 · 1 comment ·
Maintainers usually reply within 1 day
-
A2A audit timestamps end in +00:00Z (invalid ISO 8601)Possibly taken @O1sumitkumar claimed this today. Openbug good first issue help wanted python
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
`cf complete zsh >> .zshrc` fails on vanilla zshMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cloudflare/cf#340 ·
Maintainers usually reply within 1 day