0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VSCodeエディタ内でprettierが動かなくなった

Last updated at Posted at 2024-08-08

多分近い将来不要になる記事

保存時にprettierが動くようにしてあったのが、VSCodeバージョンアップのせいなのか動かなくなった
バージョンは以下の通り

バージョン: 1.92.0 (user setup)
コミット: b1c0a14de1414fcdaa400695b4db1c0799bc3124
日付: 2024-07-31T23:26:45.634Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22621

エラーメッセージは以下の通り

["ERROR" - 18:50:43] Error formatting document.
["ERROR" - 18:50:43] spawn EINVAL
Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:799:9)
    at file:///c:/XXX/node_modules/prettier-plugin-apex/dist/src/parser.js:19:38
    at new Promise (<anonymous>)
    以下略

ネットで以下の記事を見つけたので
https://github.com/prettier/prettier-vscode/issues/3468
それに従って以下対応した

エラーメッセージに出ている c:/XXX/node_modules/prettier-plugin-apex/dist/src/parser.js の19行目を以下のように変更し、VSCodeを再起動したら治った

前:const process = childProcess.spawn(serializerBin, args);
後:const process = childProcess.spawn(serializerBin, args, { shell: true });

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?