Failed at the bufferutil@4.0.2 install script 'node-gyp-build'.
 微wx笑
微wx笑 2020-12-14【前端开发】
 2020-12-14【前端开发】 468
468 6
 6 0关键字:
 0关键字:
  
mac系统下执行 sudo npm install --registry=https://registry.npm.taobao.org 时提示错误信息 Failed at the bufferutil@4.0.2 install script 'node-gyp-build'.
mac系统下执行 sudo npm install --registry=https://registry.npm.taobao.org 时提示错误信息 Failed at the bufferutil@4.0.2 install script 'node-gyp-build'.
其中有一条
| 1 2 | ../src/bufferutil.c:3:10: fatal error: 'node_api.h' file not found#include <node_api.h> | 
完整输出如下:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | sudo npm install --registry=https://registry.npm.taobao.org> bufferutil@4.0.2 install /Users/aven/Documents/xslgy/vue-element-admin/node_modules/bufferutil> node-gyp-buildxcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instancexcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance  CC(target) Release/obj.target/bufferutil/src/bufferutil.o../src/bufferutil.c:3:10: fatal error: 'node_api.h' file not found#include <node_api.h>         ^~~~~~~~~~~~1 error generated.make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2gyp ERR! stack     at ChildProcess.onExit (/Users/aven/.nvm/versions/node/v4.9.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)gyp ERR! stack     at emitTwo (events.js:87:13)gyp ERR! stack     at ChildProcess.emit (events.js:172:7)gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)gyp ERR! System Darwin 16.7.0gyp ERR! command "/Users/aven/.nvm/versions/node/v4.9.1/bin/node" "/Users/aven/.nvm/versions/node/v4.9.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"gyp ERR! cwd /Users/aven/Documents/xslgy/vue-element-admin/node_modules/bufferutilgyp ERR! node -v v4.9.1gyp ERR! node-gyp -v v3.4.0gyp ERR! not ok npm ERR! Darwin 16.7.0npm ERR! argv "/Users/aven/.nvm/versions/node/v4.9.1/bin/node" "/Users/aven/.nvm/versions/node/v4.9.1/bin/npm" "install" "--registry=https://registry.npm.taobao.org"npm ERR! node v4.9.1npm ERR! npm  v2.15.11npm ERR! code ELIFECYCLEnpm ERR! bufferutil@4.0.2 install: `node-gyp-build`npm ERR! Exit status 1npm ERR! npm ERR! Failed at the bufferutil@4.0.2 install script 'node-gyp-build'.npm ERR! This is most likely a problem with the bufferutil package,npm ERR! not with npm itself.npm ERR! Tell the author that this fails on your system:npm ERR!     node-gyp-buildnpm ERR! You can get information on how to open an issue for this project with:npm ERR!     npm bugs bufferutilnpm ERR! Or if that isn't available, you can get their info via:npm ERR! npm ERR!     npm owner ls bufferutilnpm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request:npm ERR!     /Users/aven/Documents/xslgy/vue-element-admin/npm-debug.log | 
从输出可以看出 node -v v4.9.1,这是因为 node 版本太低了,切换到 nvm use 8.17.0 或更高版本试试。
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0  许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/front/2020-12-14/572.html








