AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack Fails To Resolve Next/Package.Json When Pnpm V11 EnableGlobalVirtualStore Creates Symlink Outside Project Root

With pnpm v11's enableGlobalVirtualStore enabled, node_modules/next is a symlink to a global store outside the project root. Turbopack's filesystem resolution restricts access to the project root, causing 'Couldn't find the Next.js package' in dev mode. Webpack works; this is a Turbopack-specific limitation.

highConfidence 85%Next.jsReact Server ComponentsTurbopackAffected V16.2.4Affected Vcanary

Origin Analysis

Turbopack enforces a filesystem root (defaulting to project directory) and fails to resolve the real path of symlinked packages like next when pnpm global virtual store places them outside that root, leading to inability to locate next/package.json.
1. Use pnpm v11. 2. Set enableGlobalVirtualStore: true in pnpm-workspace.yaml. 3. Install dependencies with pnpm install. 4. Run next dev (Turbopack enabled by default). 5. Open any app route; dev server fails with error about missing next/package.json.

Fixing Code Block

Edge Case Audit

Setting turbopack.root to a broad directory (e.g., user home) can cause Turbopack to watch and process unrelated files, leading to performance degradation, memory overhead, and potential unintended module resolution. On Windows, path handling and symlink semantics differ; test thoroughly. In monorepos with multiple projects, the common root may become too broad. If issues arise, remove this configuration and either disable enableGlobalVirtualStore or use webpack dev mode. This is not an official fix; future Next.js versions may handle symlinks natively, making this workaround unnecessary.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state