Uncaught Syntax Error with full stack debugging
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
I am trying to debug a next.js 14.2.2 app with vs code. I have set the following launch.json file in accordance with the nextjs docs: https://nextjs.org/docs/pages/building-your-application/configuring/debugging
When I select full stack debug and hit F5 the debugger does not start. It fails with the following error:
C:\Program Files\nodejs\node.exe --inspect .....\node_modules.bin\next
Uncaught SyntaxError C:{MY PROJECT DIRECTORY}\node_modules.bin\next:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at internalCompileFunction (internal/vm:128:18)
at wrapSafe (internal/modules/cjs/loader:1280:20)
at Module._compile (internal/modules/cjs/loader:1332:27)
at Module._extensions..js (internal/modules/cjs/loader:1427:10)
at Module.load (internal/modules/cjs/loader:1206:32)
at Module._load (internal/modules/cjs/loader:1022:12)
at executeUserEntryPoint (internal/modules/run_main:135:12)
at <anonymous> (internal/main/run_main_module:28:49)
Process exited with code 1
So it looks like there is an issue with the next file that is in node_modules? Can anyone help me reslove this. All of the tutorials I've seen online has everything just working with no issues.
When I select full stack debug and hit F5 the debugger does not start. It fails with the following error:
C:\Program Files\nodejs\node.exe --inspect .....\node_modules.bin\next
Uncaught SyntaxError C:{MY PROJECT DIRECTORY}\node_modules.bin\next:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at internalCompileFunction (internal/vm:128:18)
at wrapSafe (internal/modules/cjs/loader:1280:20)
at Module._compile (internal/modules/cjs/loader:1332:27)
at Module._extensions..js (internal/modules/cjs/loader:1427:10)
at Module.load (internal/modules/cjs/loader:1206:32)
at Module._load (internal/modules/cjs/loader:1022:12)
at executeUserEntryPoint (internal/modules/run_main:135:12)
at <anonymous> (internal/main/run_main_module:28:49)
Process exited with code 1
So it looks like there is an issue with the next file that is in node_modules? Can anyone help me reslove this. All of the tutorials I've seen online has everything just working with no issues.
7 Replies
Cape lionOP
I should mention I'm using app router
Sun bear
try maybe deleting node_modules and running
npm install again.Cape lionOP
Tried. No luck.
Cape lionOP
I believe the issue is that the launch.json that next provides is incorrect. They are clearly trying to run a bash script in node which makes no sense. Can anyone please povide a working launch.json?
Schneider’s Smooth-fronted Caiman
@Cape lion try this, it worked for me:
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"cwd": "${workspaceFolder}", //you may need to change this to the root of your project
"serverReadyAction": {
"pattern": "started server on .+, url: (https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}Cape lionOP
Thanks. That seems to work. They should update the docks.
Schneider’s Smooth-fronted Caiman
I agree, I found that by using the wayback machine to search the docs for an earlier version of the launch config