You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new NextJS app with Yarn yarn dlx create-next-app@canary and answer the default to all questions.
This should result in .pnp.cjs, .pnp.loader.mjs and .yarn in the root of the new project. If not, run yarn install.
Open the new project in Visual Studio Code.
Create a .vscode/launch.json file with the following content:
{"version": "0.2.0","configurations": [{// Basicly the same server side debugging configuration as the official documentation:// https://nextjs.org/docs/app/building-your-application/configuring/debugging#debugging-with-vs-code"name": "Type: Node Terminal","type": "node-terminal","request": "launch","command": "yarn run dev"},{// An alternative way to configure the debugging.// This doesn't work either with NextJS 15."name": "Type: Node","request": "launch","runtimeExecutable": "yarn","runtimeArgs": ["run","dev"],"type": "node",// This is only here to make debugging easier// The error can also be reproduced without the// integratedTerminal"console": "integratedTerminal"}]}
Run yarn run dev in the terminal. This should work fine.
In VSCode run Debug: Select and Start Debugging from the Command Palette (cmd+shift+p or ctrl-shift-p) and choose either launch configuration.
This should result in the following error:
node:internal/modules/cjs/loader:1252
throw err;
Error: Cannot find module '/Users/me/nextjs-yarn-vscode-debug-error/.pnp.cjs /Users/me/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.js'
Require stack:
- internal/preload
at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
at Function._load (node:internal/modules/cjs/loader:1075:27)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at node:internal/modules/cjs/loader:1824:12
at loadPreloadModules (node:internal/process/pre_execution:729:5)
at setupUserModules (node:internal/process/pre_execution:207:5)
at prepareExecution (node:internal/process/pre_execution:160:5)
at prepareMainThreadExecution (node:internal/process/pre_execution:55:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'internal/preload' ]
}
Current vs. Expected behavior
I expect to be able to debug my NextJS 15 application in VSCode using Yarn PnP.
However this results in the following error on startup:
node:internal/modules/cjs/loader:1252
throw err;
Error: Cannot find module '/Users/me/nextjs-yarn-vscode-debug-error/.pnp.cjs /Users/me/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.js'
Require stack:
- internal/preload
at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
at Function._load (node:internal/modules/cjs/loader:1075:27)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at node:internal/modules/cjs/loader:1824:12
at loadPreloadModules (node:internal/process/pre_execution:729:5)
at setupUserModules (node:internal/process/pre_execution:207:5)
at prepareExecution (node:internal/process/pre_execution:160:5)
at prepareMainThreadExecution (node:internal/process/pre_execution:55:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'internal/preload' ]
}
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:02:27 PDT 2024; root:xnu-11215.41.3~2/RELEASE_X86_64
Available memory (MB): 32768
Available CPU cores: 12
Binaries:
Node: 22.11.0
npm: 10.9.0
Yarn: 4.5.1
pnpm: N/A
Relevant Packages:
next: 15.0.4-canary.6
eslint-config-next: N/A
react: 19.0.0-rc-66855b96-20241106
react-dom: 19.0.0-rc-66855b96-20241106
typescript: N/A
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Developer Experience
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
It worked fine in NextJS 14
The text was updated successfully, but these errors were encountered:
Link to the code that reproduces this issue
https://github.com/IsaacAndela/nextjs-yarn-vscode-debug-error
To Reproduce
yarn dlx create-next-app@canary
and answer the default to all questions..pnp.cjs
,.pnp.loader.mjs
and.yarn
in the root of the new project. If not, runyarn install
..vscode/launch.json
file with the following content:yarn run dev
in the terminal. This should work fine.Debug: Select and Start Debugging
from the Command Palette (cmd+shift+p
orctrl-shift-p
) and choose either launch configuration.Current vs. Expected behavior
I expect to be able to debug my NextJS 15 application in VSCode using Yarn PnP.
However this results in the following error on startup:
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:02:27 PDT 2024; root:xnu-11215.41.3~2/RELEASE_X86_64 Available memory (MB): 32768 Available CPU cores: 12 Binaries: Node: 22.11.0 npm: 10.9.0 Yarn: 4.5.1 pnpm: N/A Relevant Packages: next: 15.0.4-canary.6 eslint-config-next: N/A react: 19.0.0-rc-66855b96-20241106 react-dom: 19.0.0-rc-66855b96-20241106 typescript: N/A Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Developer Experience
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
It worked fine in NextJS 14
The text was updated successfully, but these errors were encountered: