Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update VSCode launch.json debugging configuration in README.md #576

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

saiki987
Copy link

@saiki987 saiki987 commented Oct 21, 2023

When debugging via the VSCode on Windows 11, I got the following error:

Uncaught SyntaxError C:\~~\node_modules\.bin\jscodeshift:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at internalCompileFunction (internal/vm:73:18)
    at wrapSafe (internal/modules/cjs/loader:1176:20)
    at <anonymous> (internal/modules/cjs/loader:1218:27)
    at <anonymous> (internal/modules/cjs/loader:1308:10)
    at <anonymous> (internal/modules/cjs/loader:1117:32)
    at <anonymous> (internal/modules/cjs/loader:958:12)
    at executeUserEntryPoint (internal/modules/run_main:81:12)
    at <anonymous> (internal/main/run_main_module:23:47)
vm:73

I found the solution here and confirmed the new configuration works correctly.

"outFiles": []
"outFiles": [],
"windows": {
"program": "${workspaceRoot}/node_modules/jscodeshift/bin/jscodeshift.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try ${workspaceRoot}/node_modules/.bin/jscodeshift.cmd and see if that works - for more consistency with how it's done for other platforms.

Copy link
Author

@saiki987 saiki987 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your reply.
When I tried to launch debugger using it, I got the following error in DEBUG CONSOLE:

C:\Program Files\Volta\node.exe --nolazy .\node_modules\.bin\jscodeshift.cmd --dry --print -t transform.js --parser babel --run-in-band target.js
Uncaught SyntaxError .\node_modules\.bin\jscodeshift.cmd:1
@IF EXIST "%~dp0\node.exe" (
^

SyntaxError: Invalid or unexpected token
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at <anonymous> (node:internal/modules/cjs/loader:1220:27)
    at <anonymous> (node:internal/modules/cjs/loader:1310:10)
    at <anonymous> (node:internal/modules/cjs/loader:1119:32)
    at <anonymous> (node:internal/modules/cjs/loader:960:12)
    at executeUserEntryPoint (node:internal/modules/run_main:81:12)
    at <anonymous> (node:internal/main/run_main_module:23:47)
Process exited with code 1

It seems that vscode runs .\node_modules\.bin\jscodeshift.cmd using node.

When I ran .\node_modules\.bin\jscodeshift.cmd --dry --print -t transform.js --parser babel --run-in-band target.js it was successfull but I couldn't find any settings in launch.json to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants