美文网首页
在windows上配置NWJS+Dll步骤记录

在windows上配置NWJS+Dll步骤记录

作者: JomarWu | 来源:发表于2018-08-23 20:13 被阅读0次

    新项目预研在KittenBlock上添加我们接口的Block,里面用到了NWJS,跟以往的Electron框架类似。
    基本步骤都是npm安装好ffi之后,重新编译ffi和ref两个库,这里编译用nw-gyp代替node-gyp。

    先总结一下版本,其他版本可能有坑

    1. node v8.11.4
    2. npm v5.7.1
    3. ffi 使用gavignus/node-ffi#torycl/forceset-fix分支
    4. nw-gyp v3.6.2
    5. nw.js v0.32.3

    配置过程中的问题


    1. 已经成功添加了Dobot的Block
    2. 调用Dll出现报错

    Uncaught Error: The module '\?\C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ref\build\Release\binding.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 57. This version of Node.js requires
    NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
    the module (for instance, using npm rebuild or npm install).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:760:18)
    at Module.load (internal/modules/cjs/loader.js:623:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:562:12)
    at Function.Module._load (internal/modules/cjs/loader.js:554:3)
    at Module.require (internal/modules/cjs/loader.js:661:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at bindings (C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ref\lib\ref.js:5:47)
    at Module._compile (internal/modules/cjs/loader.js:713:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:730:10)

    1. 应该是ref的编译出现了问题,重新安装ref。
    npm install ref
    
    1. 出现新问题

    C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\bindings\bindings.js:83 Uncaught Error: A dynamic link library (DLL) initialization routine failed.
    \?\C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ref\build\Release\binding.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:760:18)
    at Module.load (internal/modules/cjs/loader.js:623:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:562:12)
    at Function.Module._load (internal/modules/cjs/loader.js:554:3)
    at Module.require (internal/modules/cjs/loader.js:661:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at bindings (C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ref\lib\ref.js:5:47)
    at Module._compile (internal/modules/cjs/loader.js:713:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:730:10)

    1. 用nw-gyp重新编译ref
    npm install -g nw-gyp
    cd node_modules\ffi
    nw-gyp rebuild --target=0.32.3 nw版本号
    
    1. 编译报错

    gyp info it worked if it ends with ok
    gyp info using nw-gyp@3.6.3
    gyp info using node@8.9.3 | win32 | ia32
    gyp info spawn f:\Miniconda3\envs\py2715\python.EXE
    gyp info spawn args [ 'C:\Program Files (x86)\nodejs\node_modules\nw-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 '-G',
    gyp info spawn args 'msvs_version=auto',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\config.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Program Files (x86)\nodejs\node_modules\nw-gyp\addon.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\common.gypi',
    gyp info spawn args '-Dlibrary=shared_library',
    gyp info spawn args '-Dvisibility=default',
    gyp info spawn args '-Dnode_root_dir=C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3',
    gyp info spawn args '-Dnode_gyp_dir=C:\Program Files (x86)\nodejs\node_modules\nw-gyp',
    gyp info spawn args '-Dnode_lib_file="C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\<(target_arch)\node.lib"',
    gyp info spawn args '-Dnw_lib_file="C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\<(target_arch)\nw.lib"',
    gyp info spawn args '-Dmodule_root_dir=C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi',
    gyp info spawn args '-Dnode_engine=v8',
    gyp info spawn args '--depth=.',
    gyp info spawn args '--no-parallel',
    gyp info spawn args '-Dv13=1',
    gyp info spawn args '--generator-output',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build',
    gyp info spawn args '-Goutput_dir=.' ]
    f:\Miniconda3\envs\py2715\python.EXE: can't open file 'C:\Program': [Errno 2] No such file or directory
    gyp ERR! configure error
    gyp ERR! stack Error: gyp failed with exit code: 2
    gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files (x86)\nodejs\node_modules\nw-gyp\lib\configure.js:359:16)
    gyp ERR! stack at emitTwo (events.js:126:13)
    gyp ERR! stack at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    gyp ERR! System Windows_NT 10.0.17134
    gyp ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\nw-gyp\bin\nw-gyp.js" "rebuild" "--target=0.32.3"
    gyp ERR! cwd C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi
    gyp ERR! node -v v8.9.3
    gyp ERR! nw-gyp -v v3.6.3
    gyp ERR! not ok

    1. 参考nw-gyp的Github issue讨论,安装nw-gyp3.6.2版本,并重新编译ref和ffi
    npm install -g nw-gyp@3.6.2
    nw-gyp rebuild --target=0.32.3
    cd ..\ffi
    nw-gyp rebuild --target=0.32.3
    
    1. ref能编译成功,在编译ffi的时候出现新错误

    gyp info it worked if it ends with ok
    gyp info using nw-gyp@3.6.2
    gyp info using node@8.9.3 | win32 | ia32
    gyp info spawn f:\Miniconda3\envs\py2715\python.EXE
    gyp info spawn args [ 'C:\Program Files (x86)\nodejs\node_modules\nw-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 '-G',
    gyp info spawn args 'msvs_version=auto',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\config.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Program Files (x86)\nodejs\node_modules\nw-gyp\addon.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\common.gypi',
    gyp info spawn args '-Dlibrary=shared_library',
    gyp info spawn args '-Dvisibility=default',
    gyp info spawn args '-Dnode_root_dir=C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3',
    gyp info spawn args '-Dnode_gyp_dir=C:\Program Files (x86)\nodejs\node_modules\nw-gyp',
    gyp info spawn args '-Dnode_lib_file=C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\<(target_arch)\node.lib',
    gyp info spawn args '-Dnw_lib_file=C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\<(target_arch)\nw.lib',
    gyp info spawn args '-Dmodule_root_dir=C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi',
    gyp info spawn args '-Dnode_engine=v8',
    gyp info spawn args '--depth=.',
    gyp info spawn args '--no-parallel',
    gyp info spawn args '-Dv13=1',
    gyp info spawn args '--generator-output',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build',
    gyp info spawn args '-Goutput_dir=.' ]
    gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
    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=Win32' ]
    在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
    Building assembly file ......\deps\libffi\src\x86\win32.asm
    Assembling: ......\deps\libffi\src\x86\win32.asm
    prep_cif.c
    types.c
    raw_api.c
    java_raw_api.c
    closures.c
    ffi.c
    win_delay_load_hook.cc
    ffi.vcxproj -> C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\Release\libffi.lib
    ffi.cc
    callback_info.cc
    threaded_callback_invokation.cc
    win32-dlfcn.cc
    win_delay_load_hook.cc
    ..\src\ffi.cc(111): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindin
    gs.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(114): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindin
    gs.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(123): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindin
    gs.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(124): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindin
    gs.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(125): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindin
    gs.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(126): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindin
    gs.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(132): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindin
    gs.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(58): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(59): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(60): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(63): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(64): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(65): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(72): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(73): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(74): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(75): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(76): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(88): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(91): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(94): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(97): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.v
    cxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): note: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(367): warning C4996: 'Nan::Callback::Call': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_bin
    dings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::Callback::Call”的声明
    ..\src\callback_info.cc(63): warning C4996: 'Nan::Callback::Call': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\buil
    d\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::Callback::Call”的声明
    ..\src\callback_info.cc(73): warning C4996: 'Nan::Callback::Call': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\buil
    d\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::Callback::Call”的声明
    ..\src\callback_info.cc(78): warning C4996: 'Nan::Callback::Call': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\buil
    d\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::Callback::Call”的声明
    gyp ERR! build error
    gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
    gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\nw-gyp\lib\build.js:261:23)
    gyp ERR! stack at emitTwo (events.js:126:13)
    gyp ERR! stack at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    gyp ERR! System Windows_NT 10.0.17134
    gyp ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\nw-gyp\bin\nw-gyp.js" "rebuild" "--target=0.32.3"
    gyp ERR! cwd C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi
    gyp ERR! node -v v8.9.3
    gyp ERR! nw-gyp -v v3.6.2
    gyp ERR! not ok

    1. 参考Github的讨论,重新下载并覆盖安装Node8.11.4,重新安装包
    npm install
    cd node_modules\ref
    nw-gyp rebuild --target=0.32.3
    cd ..\ffi
    nw-gyp rebuild --target=0.32.3
    
    1. 问题依旧

    gyp info it worked if it ends with ok
    gyp info using nw-gyp@3.6.2
    gyp info using node@8.11.4 | win32 | ia32
    gyp info spawn f:\Miniconda3\envs\py2715\python.EXE
    gyp info spawn args [ 'C:\Program Files (x86)\nodejs\node_modules\nw-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 '-G',
    gyp info spawn args 'msvs_version=auto',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\config.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Program Files (x86)\nodejs\node_modules\nw-gyp\addon.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\common.gypi',
    gyp info spawn args '-Dlibrary=shared_library',
    gyp info spawn args '-Dvisibility=default',
    gyp info spawn args '-Dnode_root_dir=C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3',
    gyp info spawn args '-Dnode_gyp_dir=C:\Program Files (x86)\nodejs\node_modules\nw-gyp',
    gyp info spawn args '-Dnode_lib_file=C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\<(target_arch)\node.lib',
    gyp info spawn args '-Dnw_lib_file=C:\Users\JoMar.DESKTOP-2LBC6BT\.nw-gyp\0.32.3\<(target_arch)\nw.lib',
    gyp info spawn args '-Dmodule_root_dir=C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi',
    gyp info spawn args '-Dnode_engine=v8',
    gyp info spawn args '--depth=.',
    gyp info spawn args '--no-parallel',
    gyp info spawn args '-Dv13=1',
    gyp info spawn args '--generator-output',
    gyp info spawn args 'C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build',
    gyp info spawn args '-Goutput_dir=.' ]
    gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
    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=Win32' ]
    在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
    Building assembly file ......\deps\libffi\src\x86\win32.asm
    Assembling: ......\deps\libffi\src\x86\win32.asm
    prep_cif.c
    types.c
    raw_api.c
    java_raw_api.c
    closures.c
    ffi.c
    win_delay_load_hook.cc
    ffi.vcxproj -> C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\Release
    \libffi.lib
    ffi.cc
    callback_info.cc
    threaded_callback_invokation.cc
    win32-dlfcn.cc
    win_delay_load_hook.cc
    ..\src\ffi.cc(111): error C2039: “ForceSet”: 不是“v8::Object”的成员..\src\callback_info.cc(63): warning C4996: 'Nan::Callbac
    k::Call': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_b
    indings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明C:\Users\JoMar.DESKT
    OP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::Callback::Call”的 声明
    ..\src\ffi.cc(114): error C2039: “ForceSet”: 不是“v8::Object”的成员..\src\callback_info.cc(73): warning C4996: 'Nan::Callbac
    k::Call': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_b
    indings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明C:\Users\JoMar.DESKT
    OP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::Callback::Call”的 声明
    ..\src\callback_info.cc(78): warning C4996: 'Nan::Callback::Call': 被声明为已否决..\src\ffi.cc(123): error C2039: “ForceSet”:
    不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi\build\ffi_b
    indings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明C:\Users\JoMar.DESKT
    OP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::Callback::Call”的 声明
    ..\src\ffi.cc(124): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenbl
    ock\KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(125): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenbl
    ock\KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(126): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenbl
    ock\KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(132): error C2039: “ForceSet”: 不是“v8::Object”的成员 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenbl
    ock\KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT.nw-gyp\0.32.3\deps\v8\include\v8.h(3321): note: 参见“v8::Object”的声明
    ..\src\ffi.cc(58): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(59): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(60): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(63): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(64): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(65): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(72): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(73): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(74): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(75): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(76): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(88): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(91): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(94): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(97): warning C4996: 'Nan::ForceSet': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock
    KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    c:\users\jomar.desktop-2lbc6bt\desktop\scratch\kittenblock\kittenbotgui\node_modules\nan\nan_maybe_43_inl.h(130): not
    e: 参见“Nan::ForceSet”的声明
    ..\src\ffi.cc(367): warning C4996: 'Nan::Callback::Call': 被声明为已否决 [C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kitte
    nblock\KittenbotGui\node_modules\ffi\build\ffi_bindings.vcxproj]
    C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\nan\nan.h(1618): note: 参见“Nan::C
    allback::Call”的声明
    gyp ERR! build error
    gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
    gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\nw-gyp\lib\build.js:261:23)
    gyp ERR! stack at emitTwo (events.js:126:13)
    gyp ERR! stack at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    gyp ERR! System Windows_NT 10.0.17134
    gyp ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\nw-gyp\bin\nw-gyp.js" "rebuild" "--target=0.32.3"
    gyp ERR! cwd C:\Users\JoMar.DESKTOP-2LBC6BT\Desktop\Scratch\Kittenblock\KittenbotGui\node_modules\ffi
    gyp ERR! node -v v8.11.4
    gyp ERR! nw-gyp -v v3.6.2
    gyp ERR! not ok

    1. 参考github讨论,使用第三方分支的ffi,并重新编译ffi成功
    cd ..\..
    npm install ffi@gavignus/node-ffi#torycl/forceset-fix
    cd node_modules\ffi
    nw-gyp rebuild --target=0.32.3
    
    1. 重新运行项目,没有问题。

    相关文章

      网友评论

          本文标题:在windows上配置NWJS+Dll步骤记录

          本文链接:https://www.haomeiwen.com/subject/ieomiftx.html