yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.41k stars 1.11k forks source link

[Bug?]: cannot start next app in yarn pnp monorepo #5941

Open WoodenPC opened 11 months ago

WoodenPC commented 11 months ago

Self-service

Describe the bug

Hi i created test repo https://github.com/WoodenPC/test-yarn-pnp-monorepo added next app to workspaces packages with npx create-next-app@latest command from official next.js site . Tried to start dev next.js server with yarn dev command inside packages/next-app folder. Got error

TypeError: Cannot convert undefined or null to object at 9041 (C:\development\github\test-yarn-pnp-monorepo.yarn__virtual\next-virtual-833ecd6e2f\0\cache\next-npm-14.0.1-1b487ba547-d142407f47.zip\node_modules\next\dist\compiled\conf\index.js:1:105383) at __nccwpck_require (C:\development\github\test-yarn-pnp-monorepo.yarn__virtual\next-virtual-833ecd6e2f\0\cache\next-npm-14.0.1-1b487ba547-d142407f47.zip\node_modules\next\dist\compiled\conf\index.js:15:28574) at C:\development\github\test-yarn-pnp-monorepo.yarn__virtual__\next-virtual-833ecd6e2f\0\cache\next-npm-14.0.1-1b487ba547-d142407f47.zip\node_modules\next\dist\compiled\conf\index.js:15:28861 at Object. (C:\development\github\test-yarn-pnp-monorepo.yarn\virtual__\next-virtual-833ecd6e2f\0\cache\next-npm-14.0.1-1b487ba547-d142407f47.zip\node_modules\next\dist\compiled\conf\index.js:15:28905)

To reproduce

clone https://github.com/WoodenPC/test-yarn-pnp-monorepo install packages with yarn install open packages/next-app folder run yarn dev

btw. there is another simple react vite app in packages/app folder and its starts successfully also with nodeLinker pnpm next app starts correctly

Environment

System: Windows 11
Binaries: Node 20.9.0 yarn 3.2.4

Additional context

No response

WoodenPC commented 11 months ago

P.S. moving from node_modules to pnp is such a pain in monorepos. Especially with apps configured with webpack :(