環境
macOS Catalina(10.15.4)
node.js v12.16.2
発生した問題
gatsby new
をしようとしたところ以下のようなエラーが発生。
error /Users/gedyra/blog/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: /Users/gedyra/blog/node_modules/sharp
Output:
info sharp Using cached /Users/gedyra/.npm/_libvips/libvips-8.7.0-darwin-x64.tar.gz
(中略)
In file included from ../../nan/nan_converters.h:67:
../../nan/nan_converters_43_inl.h:22:1: warning: 'ToBoolean' is deprecated: ToBoolean can never throw. Use Local version. [-Wdeprecated-declarations]
X(Boolean)
(省略)
/Users/gedyra/Library/Caches/node-gyp/12.16.2/include/node/v8.h:2663:3: note: 'ToBoolean' has been explicitly marked deprecated here
V8_DEPRECATED(\"ToBoolean can never throw. Use Local version.\",
(省略)
解決策
どうやらnode v12では、すでにdeprecatedだったいくつかの関数が削除された模様。
https://kokufu.blogspot.com/2019/11/node-ffi-node-12.html
nvm use lts/dubnium
などでnode v10以下を使えば解決しました。
https://github.com/nodejs/node-gyp/issues/1941