CockpitConnect / msfs-simconnect-nodejs

Microsoft Flight Simulator 2020 SimConnect wrapper for NodeJS
https://www.cockpitconnect.com
47 stars 7 forks source link

Porting into Electron Nuxt #4

Closed StevenBCamp closed 3 years ago

StevenBCamp commented 3 years ago

Attempting to port this into electron nuxt and the build is running into in an issue where it is unable to locate the SimConnect.h The SimConnect SDK is in the root of the project folder as required. The intent here is to use electron rebuild to build all the packages. Any suggestions how to get around the below error?

PS C:\Users\XXXXX\git\electron-sim> yarn add msfs-simconnect-nodejs
yarn add v1.22.10 $ node .electron-nuxt/check-engines.js [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info fsevents@2.1.3: The platform "win32" is incompatible with this module. info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.13: The platform "win32" is incompatible with this module. info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... warning " > @xpda-dev/webpack-step@0.1.2" has unmet peer dependency "ts-loader@". warning " > @xpda-dev/webpack-step@0.1.2" has unmet peer dependency "typescript@". warning " > eslint-loader@4.0.2" has incorrect peer dependency "eslint@^6.0.0 || ^7.0.0". [5/5] Building fresh packages... [5/6] ⠂ electron [6/6] ⠂ nuxt [-/6] ⠂ waiting... [4/6] ⠂ msfs-simconnect-nodejs error C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs: Command failed. Exit code: 1 Command: node-gyp rebuild Arguments: Directory: C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs Output: C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@12.18.0 | win32 | x64 gyp info find Python using Python version 2.7.15 found at "C:\Users\XXXXX.windows-build-tools\python27\python.exe" gyp info find VS using VS2019 (16.7.30621.155) found at: gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional" gyp info find VS run with --verbose for detailed information gyp info spawn C:\Users\XXXXX.windows-build-tools\python27\python.exe gyp info spawn args [ gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\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 'C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs\build\config.gypi',
gyp info spawn args '-I', gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\XXXXX\AppData\Local\node-gyp\Cache\12.18.0\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\XXXXX\AppData\Local\node-gyp\Cache\12.18.0', gyp info spawn args '-Dnode_gyp_dir=C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\\Users\\XXXXX\\AppData\\Local\\node-gyp\\Cache\\12.18.0\\<(target_arch)\\node.lib', gyp info spawn args '-Dmodule_root_dir=C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs', 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 'C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\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 ] Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch. addon.cc win_delay_load_hook.cc C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs\src\addon.h(5,10): fatal error C1083: Cannot open include file: 'SimConnect.h': No such file or directory (compiling source file ..\src\addon.cc) [C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs\build\msfs-simconnect-nodejs.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Windows_NT 10.0.19041 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\XXXXX\git\electron-sim\node_modules\msfs-simconnect-nodejs

StevenBCamp commented 3 years ago

This needed to be recompiled and some changes were needed to the addon.cc to use newer versions of V8 engine. I created a PR to this repo. Those changes are not backwards compatible.