MacBook M3 Pro上NestJS项目执行npm i遇gyp编译错误求助
MacBook M3 Pro(Sonoma系统)下NestJS项目执行npm i时node-rdkafka编译失败
我的环境信息:
- 设备:MacBook M3 Pro
- 系统:Sonoma(Darwin 23.1.0)
- Node.js版本:18.16.0(通过nvm管理)
- npm版本:9.5.1
- 项目类型:NestJS
执行npm i时始终卡在node-rdkafka的编译环节,报错信息如下:
npm http fetch GET 200 http://nexuscloud.banco.bestado.cl/repository/npm-group/pino/-/pino-7.11.0.tgz 19734ms (cache miss) npm http fetch GET 200 http://nexuscloud.banco.bestado.cl/repository/npm-group/uuid/-/uuid-8.3.2.tgz 19745ms (cache miss) npm http fetch GET 200 http://nexuscloud.banco.bestado.cl/repository/npm-group/regexp-clone/-/regexp-clone-1.0.0.tgz 20225ms attempt #2 (cache miss) npm http fetch GET 200 http://nexuscloud.banco.bestado.cl/repository/npm-group/mongoose/-/mongoose-5.13.7.tgz 20037ms (cache miss) npm http fetch GET 200 http://nexuscloud.banco.bestado.cl/repository/npm-group/node-rdkafka/-/node-rdkafka-2.15.0.tgz 20972ms (cache miss) npm http fetch GET 200 http://nexuscloud.banco.bestado.cl/repository/npm-group/webpack/-/webpack-5.82.1.tgz 20948ms (cache miss) npm http fetch GET 200 http://nexuscloud.banco.bestado.cl/repository/npm-group/typescript/-/typescript-4.9.5.tgz 34256ms (cache miss) npm info run fsevents@2.3.3 install node_modules/fsevents node-gyp rebuild npm info run node-rdkafka@2.15.0 install node_modules/node-rdkafka node-gyp rebuild npm info run fsevents@2.3.3 install { code: 1, signal: null } npm verb reify failed optional dependency /Users/lorena/Documents/Celula Thanatos/nominas_pac/nomina-cargo-pac-pj-ms/node_modules/fsevents npm info run node-rdkafka@2.15.0 install { code: 1, signal: null } npm verb stack Error: command failed npm verb stack at ChildProcess.<anonymous> (/Users/lorena/.nvm/versions/node/v18.16.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) npm verb stack at ChildProcess.emit (node:events:513:28) npm verb stack at maybeClose (node:internal/child_process:1091:16) npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:302:5) npm verb pkgid node-rdkafka@2.15.0 npm verb cwd /Users/lorena/Documents/Celula Thanatos/nominas_pac/nomina-cargo-pac-pj-ms npm verb Darwin 23.1.0 npm verb node v18.16.0 npm verb npm v9.5.1 npm ERR! code 1 npm ERR! path /Users/lorena/Documents/Celula Thanatos/nominas_pac/nomina-cargo-pac-pj-ms/node_modules/node-rdkafka npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! LD_LIBRARY_PATH=/Users/lorena/Documents/Celula Thanatos/nominas_pac/nomina-cargo-pac-pj-ms/node_modules/node-rdkafka/build/Release/lib.host:/Users/lorena/Documents/Celula Thanatos/nominas_pac/nomina-cargo-pac-pj-ms/node_modules/node-rdkafka/build/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps; mkdir -p librdkafka; node ../util/configure npm ERR! Usage: ./configure [OPTIONS...] npm ERR! mklove/modules/configure.base: line 1036: $MKL_OUTDBG: ambiguous redirect npm ERR! Module libcurl not found (required by self) npm ERR! mklove/modules/configure.base: line 1028: $MKL_OUTDBG: ambiguous redirect npm ERR! downloading missing module parseversion from http://github.com/edenhill/mklove/raw/master/modules/configure.parseversion npm ERR! mklove/modules/configure.base: line 1045: $MKL_OUTDBG: ambiguous redirect npm ERR! Failed to download parseversion: npm ERR! mklove/modules/configure.base: line 1028: $MKL_OUTDBG: ambiguous redirect npm ERR! npm ERR! mklove/modules/configure.base: line 1036: $MKL_OUTDBG: ambiguous redirect npm ERR! Module parseversion not found (required by self) npm ERR! mklove/modules/configure.base: line 1028: $MKL_OUTDBG: ambiguous redirect npm ERR! Unknown option prefix=/Users/lorena/Documents/Celula Thanatos/nominas_pac/nomina-cargo-pac-pj-ms/node_modules/node-rdkafka/build/deps npm ERR! mklove/modules/configure.base: line 1028: $MKL_OUTDBG: ambiguous redirect npm ERR! make: *** No rule to make target `../deps/librdkafka/config.h', needed by `11a9e3388a67e1ca5c31c1d8da49cb6d2714eb41.intermediate'. Stop. npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2 npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/lorena/.nvm/versions/node/v18.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Darwin 23.1.0 npm ERR! gyp ERR! command "/Users/lorena/.nvm/versions/node/v18.16.0/bin/node" "/Users/lorena/.nvm/versions/node/v18.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /Users/lorena/Documents/Celula Thanatos/nominas_pac/nomina-cargo-pac-pj-ms/node_modules/node-rdkafka npm ERR! gyp ERR! node -v v18.16.0 npm ERR! gyp ERR! node-gyp -v v9.3.1 npm ERR! gyp ERR! not ok npm verb exit 1 npm verb unfinished npm timer reify 1706666453281 npm verb unfinished npm timer reify:build 1706667165776 npm verb unfinished npm timer build 1706667165778 npm verb unfinished npm timer build:deps 1706667165778 npm verb unfinished npm timer build:run:install 1706667165803 npm verb unfinished npm timer build:run:install:node_modules/node-rdkafka 1706667165808 npm verb code 1
已经尝试过以下操作,但问题依旧:
npm i -g node-gyprm -rf node_modules/rm -rf package-lock.jsonnpm cache clear --fnvm cache clear
有没有遇到过类似情况的开发者?
内容的提问来源于stack exchange,提问作者Lorena C. Estrella R.
相关产品推荐
相关产品推荐

