発生していたエラー
ある日、いつも通りeslintを実行しようとしたところ、SIGSEGVで終了してしまうことが起きた。
$ eslint '**/*.ts'
error Command failed with signal "SIGSEGV".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
対処法
原因を探っていたら、node_modules/bin/eslint.js
の以下のv8-compile-cache
をrequireしている行でエラーになっていることがわかった。
// to use V8's code cache to speed up instantiation time
require("v8-compile-cache");
v8-compile-cache
で類似のエラーを探していたところ、どうやらv8-compile-cache
のキャッシュが原因そうとのことだった。
v8-compile-cache
のREADMEによると、
Set the environment variable
DISABLE_V8_COMPILE_CACHE=1
to disable the cache.Cache directory is defined by environment variable
V8_COMPILE_CACHE_CACHE_DIR
or defaults to<os.tmpdir()>/v8-compile-cache-<V8_VERSION>
.
とのことなので、キャッシュを消してみたところeslintが動くようになった。
$ rm -fr $(node -r 'node:os' -e 'console.log(os.tmpdir())')/v8-compile-cache-*
たびたび起こるが、現時点ではSIGSEGVになる条件がわかっておらず、上記の対応で誤魔化している。