泉(@izumin_0401)です。
今回は、AngularでESLint設定時にesbuildエラーが出て困ったちゃんだったので解消方法を解説します。
特定のPCだけesbuildエラーが出たので、エラーが出なければそもそも対応不要です。
ブログ記事はこちら
esbuildエラー内容
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\〇〇\Documents\git\project\node_modules\esbuild-windows-64\esbuild.exe
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\〇〇\Documents\git\project\node_modules\esbuild-windows-64\esbuild.exe'
npm ERR! [Error: EPERM: operation not permitted, unlink 'C:\Users\〇〇\Documents\git\project\node_modules\esbuild-windows-64\esbuild.exe'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\〇〇\\Documents\\git\\project\\node_modules\\esbuild-windows-64\\esbuild.exe'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\〇〇\AppData\Local\npm-cache\_logs\2024-09-18T07_14_57_777Z-debug-0.log
added 1291 packages, and audited 1292 packages in 33s
196 packages are looking for funding
run `npm fund` for details
25 vulnerabilities (13 moderate, 10 high, 2 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues possible (including breaking changes), run:
npm audit fix --force
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
esbuildエラー解消方法
package.jsonに追記
"overrides": {
"esbuild": "npm:esbuild-wasm@latest"
}
VSCodeのsetting.jsonに追記
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
これでOK!!
まとめ
ESLintは色々ハマりポイントがあるよね。
ではまた!
参考サイト