Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid string length #5

Open
6 of 7 tasks
mootoday opened this issue Feb 3, 2025 · 5 comments
Open
6 of 7 tasks

Invalid string length #5

mootoday opened this issue Feb 3, 2025 · 5 comments

Comments

@mootoday
Copy link

mootoday commented Feb 3, 2025

Describe the bug

Hey Anthony,

I'm aware this is still an early preview, but thought I'd share in case others run into it.

I ran pnpx [email protected] in a monorepo and it failed with what I boiled down to the following command:

pnpm ls --json --no-optional --depth 25 --recursive
{
  "error": {
    "code": "pnpm",
    "message": "Invalid string length"
  }
}

Unfortunately, the project isn't open source, but happy to help troubleshoot if I can in any way. I won't be able to provide a reproduction either, so I won't be offended if you close the issue 😊.

Reproduction

N/A

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M2
    Memory: 51.09 MB / 16.00 GB
    Shell: Unknown (note, it's zsh)
  Binaries:
    Node: 18.17.1 - ~/projects/xyz/.devbox/nix/profile/default/bin/node
    npm: 9.6.7 - ~/projects/xyz/.devbox/nix/profile/default/bin/npm
    pnpm: 9.7.0 - ~/projects/xyz/.devbox/virtenv/nodejs/corepack-bin/pnpm
  Browsers:
    Brave Browser: 132.1.74.48
    Safari: 17.5

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!)
@mootoday
Copy link
Author

mootoday commented Feb 3, 2025

FWIW, it works with --depth 12, but starts failing with --depth 13.

@OrbisK
Copy link
Contributor

OrbisK commented Feb 3, 2025

can you share your lockfile?

@AlexanderMykulych
Copy link

AlexanderMykulych commented Feb 4, 2025

+1
have the exact same problem on my pnpm monorepo.
pnpm ls --json --no-optional --depth 9 works normally.
pnpm ls --json --no-optional --depth 10 fails with the error “Invalid string length”.

these are pnpm issues:

@antfu
Copy link
Owner

antfu commented Feb 4, 2025

Could you try with 0.0.6 where I switched the json parser to use streams?

@mootoday
Copy link
Author

mootoday commented Feb 4, 2025

I tried with 0.0.6:

pnpx [email protected]
Packages: +63
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 63, reused 63, downloaded 0, added 63, done
ℹ Starting Node Modules Inspector at http://localhost:6670

✔ Websocket client connected
[node-modules-inspector] RPC error on executing "listDependencies":
TypeError: tree.map is not a function
    at Module.listPackageDependencies (file:///Users/m/Library/Caches/pnpm/dlx/t6euwyornv2kejjpaqirjiq4si/194d183a67a-116a/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/chunks/pnpm.mjs:45:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async listPackageDependenciesRaw (file:///Users/m/Library/Caches/pnpm/dlx/t6euwyornv2kejjpaqirjiq4si/194d183a67a-116a/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/index.mjs:146:14)
    at async listPackageDependencies (file:///Users/m/Library/Caches/pnpm/dlx/t6euwyornv2kejjpaqirjiq4si/194d183a67a-116a/node_modules/.pnpm/[email protected]/node_modules/node-modules-tools/dist/index.mjs:218:18)
    at async Proxy.listDependencies (file:///Users/m/Library/Caches/pnpm/dlx/t6euwyornv2kejjpaqirjiq4si/194d183a67a-116a/node_modules/.pnpm/[email protected]/node_modules/node-modules-inspector/dist/cli.mjs:27:22)
    at async onMessage (file:///Users/m/Library/Caches/pnpm/dlx/t6euwyornv2kejjpaqirjiq4si/194d183a67a-116a/node_modules/.pnpm/[email protected]/node_modules/birpc/dist/index.mjs:101:20)
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants