vercel / next.js

The React Framework
https://nextjs.org
MIT License
123.02k stars 26.28k forks source link

Next starter app fails to launch when using Yarn 2 PnP #33163

Closed imdavidmin closed 2 years ago

imdavidmin commented 2 years ago

Run next info (available from version 12.0.8 and up)

No response

What version of Next.js are you using?

12.0.7

What version of Node.js are you using?

16.13.1

What browser are you using?

Chromium Edge

What operating system are you using?

Windows

How are you deploying your application?

Local

Describe the Bug

Internal server error message visiting localhost:3000

Expected Behavior

Show Vercel / Next.js starter page as expected.

To Reproduce

Followed the instruction from here: https://nextjs.org/docs/getting-started

Creates the repo okay, but when running yarn dev shows error

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
error - ./.yarn/__virtual__/next-virtual-bd727ec14e/0/cache/next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip/node_modules/next/dist/client/dev/amp-dev.js
Error: Failed to read source code from C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\client\dev\amp-dev.js

Caused by:
    The system cannot find the path specified. (os error 3)
wait  - compiling...
error - ./.yarn/__virtual__/next-virtual-bd727ec14e/0/cache/next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip/node_modules/next/dist/client/dev/webpack-hot-middleware-client.js
Error: Failed to read source code from C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\client\dev\webpack-hot-middleware-client.js

Caused by:
    The system cannot find the path specified. (os error 3)
wait  - compiling...
error - ./.yarn/__virtual__/next-virtual-bd727ec14e/0/cache/next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip/node_modules/next/dist/client/dev/webpack-hot-middleware-client.js
Error: Failed to read source code from C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\client\dev\webpack-hot-middleware-client.js

Caused by:
    The system cannot find the path specified. (os error 3)
(node:23228) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
wait  - compiling /_error (client and server)...
error - ./.yarn/__virtual__/next-virtual-bd727ec14e/0/cache/next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip/node_modules/next/dist/client/dev/error-overlay/format-webpack-messages.js
Error: Failed to read source code from C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\client\dev\error-overlay\format-webpack-messages.js
Caused by:
    The system cannot find the path specified. (os error 3)

When navigating to localhost:3000, the below appears.

error - Error: Qualified path resolution failed - none of those files can be found on the disk.

Source path: C:\Code\.Starters\next-js\next-starter-12\.next\fallback-build-manifest.json
Not found: C:\Code\.Starters\next-js\next-starter-12\.next\fallback-build-manifest.json
Not found: C:\Code\.Starters\next-js\next-starter-12\.next\fallback-build-manifest.json.js
Not found: C:\Code\.Starters\next-js\next-starter-12\.next\fallback-build-manifest.json.json
Not found: C:\Code\.Starters\next-js\next-starter-12\.next\fallback-build-manifest.json.node

Require stack:
- C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\server\load-components.js
- C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\build\utils.js
- C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\build\output\store.js
- C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\build\output\index.js
- C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\cli\next-dev.js
- C:\Code\.Starters\next-js\next-starter-12\.yarn\__virtual__\next-virtual-bd727ec14e\0\cache\next-npm-12.0.7-4cffaa57c8-78a0ebd697.zip\node_modules\next\dist\bin\next
Error: Qualified path resolution failed - none of those files can be found on the disk.
imdavidmin commented 2 years ago

Further investigation shows using Yarn 2 PnP introduces this error,

Current workaround: Revert to node_modules

  1. Create .yarnrc.yml as per migration instructions , with the file content being nodeLinker: node-modules
  2. Run yarn install in the project folder. This installs all dependencies in node_modules folder format.
  3. Run yarn dev as per normal.
imdavidmin commented 2 years ago

Possible duplicate of #32115

balazsorban44 commented 2 years ago

Does sound like a duplicate of #32115

balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.