gyp ERR! stack Error: `make` failed with exit code: 2

1,208 阅读1分钟

问题描述

1 error generated.
make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/xxx/test/starfish-h5/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (node:events:526:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.1.0
gyp ERR! command "/usr/local/bin/node" "/Users/xxx/test/starfish-h5/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/xxx/test/starfish-h5/node_modules/node-sass
gyp ERR! node -v v16.14.2

问题原因

由于升级NodeJS,核心库现在指向更新版本的 C++。需要指定特定版本的 C++ 版本才能正常。

解决方案

rm -rf node_modules
rm yarn.lock
yarn install -std=c++17

相关资源

stackoverflow