V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wiselyv2
V2EX  ›  Node.js

node gyp rebuild command failed 是什么问题

  •  1
     
  •   wiselyv2 · 2021-12-17 11:25:54 +08:00 · 4981 次点击
    这是一个创建于 1107 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    • nodejs 16.13.1
    • Rust
    • yarn
    • visual studio 2019 build tools
    • win builds(mingw)

    都安装了,还是不行,我觉得是 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 [email protected]
    gyp info using [email protected] | 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
    
    6 条回复    2021-12-18 13:36:56 +08:00
    youxiachai
        1
    youxiachai  
       2021-12-17 13:03:27 +08:00
    碰到这种...一般放弃吧...别人搞这个.没怎么考虑 windows...
    muzuiget
        2
    muzuiget  
       2021-12-17 13:29:35 +08:00
    没有找到 node.h 的这个文件,这个文件一般在 node 的安装目录的 include 文件夹下。

    多半编译配置问题,比如要添加环境变量之类的,Windows 要怎么搞不清楚,建议看一下项目的编译相关文档。
    gadfly3173
        3
    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
        4
    CokeMine  
       2021-12-17 16:17:41 +08:00 via Android
    node-gyp 在 Windows 下就是个玄学....
    joesonw
        5
    joesonw  
       2021-12-17 16:38:02 +08:00
    https://github.com/ddopson/node-segfault-handler/issues/33 这个库没有 node-pre-gyp, 只能现场编译.
    IvanLi127
        6
    IvanLi127  
       2021-12-18 13:36:56 +08:00
    D:\Eth miner\

    搞个没空格的路径再试试?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2251 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 01:42 · PVG 09:42 · LAX 17:42 · JFK 20:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.