node gyp rebuild command failed 是什么问题

2021-12-17 11:25:54 +08:00
 wiselyv2

从 github 上 down 下来的一个项目,在 ubuntu 上面可以编译成功,但是在 win10 上就一直编译错误,项目所需的环境都配置了,

都安装了,还是不行,我觉得是 node 这边的错误,本人对 node 七窍通了六窍,现在去学也来不及了,所以特地求助,

编译错误如下(执行 yarn install)后的输出,只能将希望寄托于这里的大神了。

error D:\Eth miner\Ironfish_miner\miner2\ironfish\node_modules\segfault-handler: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: D:\Eth miner\Ironfish_miner\miner2\ironfish\node_modules\segfault-handler
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.13.1 | win32 | x64
gyp info find Python using Python version 3.10.1 found at "C:\Python310\python.exe"
gyp info find VS using VS2019 (16.11.32002.261) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
(node:16988) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn C:\Python310\python.exe
gyp info spawn args [
gyp info spawn args   'D:\\Eth miner\\Ironfish_miner\\miner2\\ironfish\\node_modules\\@npmcli\\run-script\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Eth miner\\Ironfish_miner\\miner2\\ironfish\\node_modules\\segfault-handler\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Eth miner\\Ironfish_miner\\miner2\\ironfish\\node_modules\\@npmcli\\run-script\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\herominer\\AppData\\Local\\node-gyp\\Cache\\16.13.1\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\herominer\\AppData\\Local\\node-gyp\\Cache\\16.13.1',
gyp info spawn args   '-Dnode_gyp_dir=D:\\Eth miner\\Ironfish_miner\\miner2\\ironfish\\node_modules\\@npmcli\\run-script\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\herominer\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\Eth miner\\Ironfish_miner\\miner2\\ironfish\\node_modules\\segfault-handler',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\Eth miner\\Ironfish_miner\\miner2\\ironfish\\node_modules\\segfault-handler\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
  segfault-handler.cpp
D:\Eth miner\Ironfish_miner\miner2\ironfish\node_modules\nan\nan.h(58,10): fatal error C1083: 无法打开包括文件: “node.h”: No such file or directory [D:\Eth miner\Ironfish_miner\miner2\ironfish\node_modules\segfault-handler\build\segfault-handler.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Eth miner\Ironfish_miner\miner2\ironfish\node_modules\@npmcli\run-script\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Eth miner\\Ironfish_miner\\miner2\\ironfish\\node_modules\\@npmcli\\run-script\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Eth miner\Ironfish_miner\miner2\ironfish\node_modules\segfault-handler
4755 次点击
所在节点    Node.js
6 条回复
youxiachai
2021-12-17 13:03:27 +08:00
碰到这种...一般放弃吧...别人搞这个.没怎么考虑 windows...
muzuiget
2021-12-17 13:29:35 +08:00
没有找到 node.h 的这个文件,这个文件一般在 node 的安装目录的 include 文件夹下。

多半编译配置问题,比如要添加环境变量之类的,Windows 要怎么搞不清楚,建议看一下项目的编译相关文档。
gadfly3173
2021-12-17 16:15:35 +08:00
https://github.com/nodejs/node-gyp#on-windows segfault-handler 似乎没提到 windows 下有安装问题 可以看看 node-gyp 的这个文档(总觉得你这 python3.10 有点太新了)
CokeMine
2021-12-17 16:17:41 +08:00
node-gyp 在 Windows 下就是个玄学....
joesonw
2021-12-17 16:38:02 +08:00
https://github.com/ddopson/node-segfault-handler/issues/33 这个库没有 node-pre-gyp, 只能现场编译.
IvanLi127
2021-12-18 13:36:56 +08:00
D:\Eth miner\

搞个没空格的路径再试试?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/822772

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX