- The demo.js file is made to work standalone. If you rebuild the node_module winRT modules to work with electron, then they wont run standalone and have to be recompiled in order to run standalone. Trying to run them against a platform that is different
npm install guide4
was compiled against a different Node.js version using
NODE_MODULE_VERSION 76. This version of Node.js requires
NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
`
In order to bypass this error just re-install the modules in question or drop the node_modules folder and re-install everything. Just keep in mind if you did any custom compilation of modules like the nodeRT windows.storage module those changes will get blown away.
System Requirements
#### Windows
| Asset | Version |
| -------- | ------- |
| node | 16.14.2 |
| npm | 6.14.11 |
| python | |
| node-gyp | |
#### Mac
| Asset | Version |
| -------- | ------- |
| node | 16.14.2 |
| npm | 7.19.1 |
| python | 2.7.18 |
| node-gyp | 8.3.0 |
Package.json notes
"postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main",
Daily development
Debugging is setup to work in vscode ala electron-forge. To run the debugger simply open the project and in vscode go to the debugger tab and click launch.i have
API Reference for NodeAPI / Node Addon
- This is Tony's recommendations on how to communicate easily between C++ Addon and our Electron JS app
https://nodejs.org/dist/latest/docs/api/addons.html
Setup Mac environment for Guide4 client app development
1. Install VSCode
2. clone repo git clone git@bitbucket.org:honcho_works/guide.git - clone using base repo
3. Setup your env.local file for websocket endpoint and kafka connection - add the following to the end of env file (config folder within base repo)
#Guide Client POC
DETECTION_API_WS_ENDPOINT=wss://s0vscvfjac.execute-api.us-west-2.amazonaws.com/staging/
GUIDE_CLIENT_KEYLOGGER_OUTPUT_FILE=keystroke.log
SYNC_KAFKA_BROKERS=pkc-pgq85.us-west-2.aws.confluent.cloud:9092
SYNC_KAFKA_CLIENT_ID=my-app
SYNC_KAFKA_GROUP_ID=test-group
SYNC_KAFKA_SASL_USERNAME=7NC5FN7CSE4MPHVO
SYNC_KAFKA_SASL_PASSWORD=ysuobjP9X+i9tnSlE5kkBpykg799vNKm9bo/H6jecbM1TQRqDLZu09YjIHY2Mz2a
SYNC_KAFKA_TOPICS=staging.gc4settings.test5.guide.customers
4. Open guide/main folder in VSCode
5. Run npm run clean
6. Run npm run start.electron.desktop
Setup Windows environment for Guide4 client app development
1. Install latest windows SDK
2. Install GIT for Windows
3. Install Visual Studio Code
4. Install Visual Studio 2017 Pro/Community
5. Install Visual C++ Build Environment: Visual Studio Build
Tools (using "Visual C++ build tools" workload) or Visual Studio 2017 Community (using the "Desktop development with C++" workload) -- use Visual Studio Installer
6. git clone (clone using base repo)
7. Setup your env.local file for websocket endpoint and kafka connection - add the following to the end of env file (config folder within base repo)
#Guide Client POC
DETECTION_API_WS_ENDPOINT=wss://s0vscvfjac.execute-api.us-west-2.amazonaws.com/staging/
GUIDE_CLIENT_KEYLOGGER_OUTPUT_FILE=keystroke.log
SYNC_KAFKA_BROKERS=pkc-pgq85.us-west-2.aws.confluent.cloud:9092
SYNC_KAFKA_CLIENT_ID=my-app
SYNC_KAFKA_GROUP_ID=test-group
SYNC_KAFKA_SASL_USERNAME=7NC5FN7CSE4MPHVO
SYNC_KAFKA_SASL_PASSWORD=ysuobjP9X+i9tnSlE5kkBpykg799vNKm9bo/H6jecbM1TQRqDLZu09YjIHY2Mz2a
SYNC_KAFKA_TOPICS=staging.gc4settings.test5.guide.customers
8. from main folder - npm run clean
9. run app using - npm run start.electron.desktop
Debugging
- Press F5 to start debugging in VSCode
- Open chrome://inspect/#devices in chrome and select electron in Remote Target list to debug
Proxy settings
To use proxy you need to set params in env file:
- GUIDE_CLIENT_useElectronProxy=1 or useElectronProxy=true
- GUIDE_CLIENT_proxyType=Direct | System | Supplied
- GUIDE_CLIENT_proxyEndpoint=socks5://...
Direct proxyType means no proxy;
System proxyType means use system proxy config;
Supplied proxyType means use proxy string from proxyEndpoint.
Make sure supplied proxy server supports all types of connections used in the app - http, https, websockets, etc.
Same for system proxy - it should support those connections. In other case connections will be dropped.
Troubleshooting Windows environemnt setup
1. Unexpected compiler error
C1189: #error: STL1001: Unexpected compiler version, expected MSVC 19.28 or newer.
1A. run cmd - npm config set msvs_version 2017
2. Cannot find file platform.winmd
2A. Run this PS script. Update paths to match your installation folder for Windows SDK
new-item -ItemType "directory" -Path "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\store\references"
Copy-Item "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x86\store\references\platform.winmd" -Destination "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\store\references"
Copy-Item "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22000.0\Windows.winmd" -Destination "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\store\references"
3. Visual Studio Build Tools download URL
3A. https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools
4. Error trying to run on windows?
× Preparing native dependencies: 0 / 1
An unhandled error has occurred inside Forge:
Traceback (most recent call last):
File "C:\Users\Me\source\repos\Honcho\guidePaul\guide\main\node_modules\electron-forge\node_modules\electron-rebuild\node_modules\node-gyp\gyp\gyp_main.py", line 50, in
sys.exit(gyp.script_main())
File "C:\Users\Me\source\repos\Honcho\guidePaul\guide\main\node_modules\electron-forge\node_modules\electron-rebuild\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 554, in script_main
return main(sys.argv[1:])
File "C:\Users\Me\source\repos\Honcho\guidePaul\guide\main\node_modules\electron-forge\node_modules\electron-rebuild\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 547, in main
return gyp_main(args)
File "C:\Users\Me\source\repos\Honcho\guidePaul\guide\main\node_modules\electron-forge\node_modules\electron-rebuild\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 532, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "C:\Users\Me\source\repos\Honcho\guidePaul\guide\main\node_modules\electron-forge\node_modules\electron-rebuild\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2030, in GenerateOutput
sln_projects, project_objects, flat=msvs_version.FlatSolution())
File "C:\Users\Me\source\repos\Honcho\
Delete your package-lock.json then do a npm run clean and then npm start.electron.desktop
-this is due to mac dependency of fsevents for chokidar, webpack-dev-server and angular. this issue should be fixed so we can share pacakge-lock.json for Windows/Mac.
5. Trying to run/debug on Mac? Getting error about fsevents? Delete your package-lock.config and run npm run clean
n unhandled error has occurred inside Forge:
node_modules/@electron-forge/async-ora/dist/ora-handler.js:63
node-gyp failed to rebuild '/Users/michaelmorley/source/repos/honcho/base/base/guide/main/node_modules/@angular-devkit/build-angular/node_modules/fsevents'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".
Error: gyp failed with exit code: 1
node_modules/@electron-forge/async-ora/dist/ora-handler.js:64
Error: node-gyp failed to rebuild '/Users/michaelmorley/source/repos/honcho/base/base/guide/main/node_modules/@angular-devkit/build-angular/node_modules/fsevents'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".
Error: gyp` failed with exit code: 1