Skip to content

Invalid string length #102

@BleedingDev

Description

@BleedingDev

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/node-modules-tools@0.6.7/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/node-modules-tools@0.6.7/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/node-modules-tools@0.6.7/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/node-modules-tools@0.6.7/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/node-modules-tools@0.6.7/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

  1. Use Windows + Powershell
  2. Run pnpx node-modules-inspector in any repository
  3. 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!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions