0

环境:

卡特琳娜 10.15.7

npm v5.5.1

节点 v8.9.3

节点gyp v8.3.0

python #python -V当我运行时我得到 2.7.16 但是当我运行时

我明白了

gyp info find Python using Python version 3.8.3 found at "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3"所以我认为 node-gyp 正在寻找可接受的 python 版本,但这可能是问题所在?

约束:我必须使用节点 v8.9.3 和 Catalina(我的升级空间为零)。

我试过的:

  1. 我跑了

xcode-select --install

但我已经有了。所以我跑了

sudo xcode-select --switch /Library/Developer/CommandLineTools

我跑了curl -sL https://github.com/nodejs/node-gyp/raw/master/macOS_Catalina_acid_test.sh | bash ,效果很好。

  1. 我卸载并重新安装了 xcode-select,再次执行上述过程,结果相似,所以我认为不是这样。
  2. 我在全球范围内卸载并重新安装了我的 node-gyp。npm_config_node_gyp=<path to node-gyp>然后我根据https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md为我的 npm 配置设置一个环境变量, 并验证它是正确的。我把它放在我的 .bash-profile 中,打开一个新终端,然后在配置文件中看到它。
  3. 我试过删除我的 node_modules 和我的 package-lock.json。

运行的堆栈跟踪

/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/bin/node /Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/bin/node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@8.3.0
gyp info using node@8.9.3 | darwin | x64
gyp info find Python using Python version 3.8.3 found at "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3"
gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
gyp ERR! stack     at Object.promisify (internal/util.js:206:11)
gyp ERR! stack     at Object.<anonymous> (/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/lib/node_modules/node-gyp/lib/install.js:15:29)
gyp ERR! stack     at Module._compile (module.js:635:30)
gyp ERR! stack     at Object.Module._extensions..js (module.js:646:10)
gyp ERR! stack     at Module.load (module.js:554:32)
gyp ERR! stack     at tryModuleLoad (module.js:497:12)
gyp ERR! stack     at Function.Module._load (module.js:489:3)
gyp ERR! stack     at Module.require (module.js:579:17)
gyp ERR! stack     at require (internal/module.js:11:18)
gyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/lib/node_modules/node-gyp/lib/node-gyp.js:41:14)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/bin/node" "/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/tristanshawnjohnson/Work/lms-spa
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v8.3.0
gyp ERR! Node-gyp failed to build your package

在这里运行

npm install


> node-expat@2.3.16 install /Users/tristanshawnjohnson/Work/lms-spa/node_modules/node-expat
> node-gyp rebuild

gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
gyp ERR! stack     at Object.promisify (internal/util.js:206:11)
gyp ERR! stack     at Object.<anonymous> (/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/lib/node_modules/node-gyp/lib/install.js:15:29)
gyp ERR! stack     at Module._compile (module.js:635:30)
gyp ERR! stack     at Object.Module._extensions..js (module.js:646:10)
gyp ERR! stack     at Module.load (module.js:554:32)
gyp ERR! stack     at tryModuleLoad (module.js:497:12)
gyp ERR! stack     at Function.Module._load (module.js:489:3)
gyp ERR! stack     at Module.require (module.js:579:17)
gyp ERR! stack     at require (internal/module.js:11:18)
gyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/lib/node_modules/node-gyp/lib/node-gyp.js:41:14)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/bin/node" "/Users/tristanshawnjohnson/.nvm/versions/node/v8.9.3/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/tristanshawnjohnson/Work/lms-spa/node_modules/node-expat
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v8.3.0
gyp ERR! Node-gyp failed to build your package.
gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
npm WARN eslint-config-airbnb-base@11.3.1 requires a peer of eslint@^3.19.0 || ^4.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-import@2.7.0 requires a peer of eslint@2.x - 4.x but none is installed. You must install peer dependencies yourself.
npm WARN mongoose-delete@0.4.0 requires a peer of mongoose@4.x but none is installed. You must install peer dependencies yourself.
npm WARN sinon-mongoose@2.1.1 requires a peer of sinon@2.1 - 4 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! node-expat@2.3.16 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the node-expat@2.3.16 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tristanshawnjohnson/.npm/_logs/2021-10-28T22_00_44_615Z-debug.log

抱歉,我无法弄清楚这一点。这是我第一次在stackoverflow上找不到解决方案。任何帮助表示赞赏。

4

0 回答 0