gpt4 book ai didi

node.js - 执行 npm install 时出现 node-gyp 错误

转载 作者:IT老高 更新时间:2023-10-28 23:14:44 27 4
gpt4 key购买 nike

我正在从一个项目中进行 npm 安装,但我在 node-gyp 中遇到了这个奇怪的错误。

> pty.js@0.2.3 install /home/charizard/Open/terminal-codelearn/node_modules/pty.js
> node-gyp rebuild

npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/tinycolor
npm http GET https://registry.npmjs.org/options
gyp ERR! configure error
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
gyp ERR! stack at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:65:16)
gyp ERR! stack at Object.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:66:37)
gyp ERR! stack at getNodeDir (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:228:20)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:110:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:659:7)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:106:17)
gyp ERR! stack at maybeClose (child_process.js:773:16)
gyp ERR! stack at Socket.<anonymous> (child_process.js:986:11)
gyp ERR! stack at Socket.EventEmitter.emit (events.js:103:17)
gyp ERR! stack at Pipe.close (net.js:458:12)
gyp ERR! System Linux 3.5.0-37-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/charizard/Open/terminal-codelearn/node_modules/pty.js
gyp ERR! node -v v0.11.8-pre
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1

当我执行 npm list 时,我收到以下消息。

npm ERR! missing: pty.js@>=0.2.2, required by terminal-codelearn@0.0.3
npm ERR! not ok code 0

对不起,我对 nodejs 完全陌生。

最佳答案

发生这种情况的原因是 node-gypnode@0.11.8-pre-pre 部分评估为 -1。然后安装收到 404 并失败。

gyp http GET http://nodejs.org/dist/v0.8.-1/node-v11.8.-1.tar.gz
gyp http 404 http://nodejs.org/dist/v0.8.-1/node-v11.8.-1.tar.gz

要解决这个问题,请使用 Node.js 的稳定版本。否则,您需要放置 Node 源代码,并使用 --nodedir 标志。

npm install --nodedir=/node/src/

您可以阅读有关此问题的更多信息 here .

关于node.js - 执行 npm install 时出现 node-gyp 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18777882/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com