prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

Prettier error spawnSync EINVAL when formatting Apex classes

Open YSF17796 opened this issue 7 months ago • 2 comments
trafficstars

When attempting to format Apex code using prettier-plugin-apex, receiving a spawn EINVAL error. The error occurs during the child process spawning phase.

Error: spawn EINVAL at ChildProcess.spawn (node:internal/child_process:420:11) at Object.spawn (node:child_process:777:9) at file: node_modules/prettier-plugin-apex/dist/src/parser.js:12:38 at new Promise () at parseTextWithSpawn (file:///node_modules/prettier-plugin-apex/dist/src/parser.js:11:12) at Object.parse (file:////node_modules/prettier-plugin-apex/dist/src/parser.js:446:31) at parse4 (file:////node_modules/prettier/index.mjs:22117:24) at async coreFormat (file:///node_modules/prettier/index.mjs:22607:7) at async formatWithCursor (file:////node_modules/prettier/index.mjs:22809:14) at async Module.format2 (file:////node_modules/prettier/index.mjs:24194:25)

Solution: /node_modules/prettier-plugin-apex/dist/src/parser.js const process = childProcess.spawn(executable, args); ===> const process = childProcess.spawn(executable, args, { shell: true });

YSF17796 avatar Apr 10 '25 02:04 YSF17796