I've been trying to embed node red directly into an Electron app. Unfortunately, the flow we are using relies on the serial port nodes to work correctly, but I cannot get the serial port nodes to work in the embedded instance.
If I run the file directly (not called through the Electron instance), the serial port nodes appear as expected and work correctly.
However, when I launch the Electron app and it calls the same file that loaded them correctly, node red tells me that the serial port nodes are missing. node-red-node-serialport is still loaded in the pallette manager, but it has an error:
I have also tried this on the electron-node-red app (https://github.com/natcl/electron-node-red). The app will let me install the serial port from the pallette manager and use them in flows, but if I stop the app and restart it, the same issue happens.
Any information about this would be greatly appreciated, thanks.
This is what it says when I launch the file outside of Electron:
17 May 12:39:06 - [info] Node-RED version: v0.20.5
util.js:256
17 May 12:39:06 - [info] Node.js version: v10.15.3
util.js:256
17 May 12:39:06 - [info] Windows_NT 10.0.17763 x64 LE
util.js:256
17 May 12:39:07 - [info] Loading palette nodes
util.js:256
17 May 12:39:08 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
util.js:256
17 May 12:39:08 - [info] Context store : 'default' [module=memory]
util.js:256
17 May 12:39:08 - [info] User directory : c:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI/.node-red/
util.js:256
17 May 12:39:08 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
util.js:256
17 May 12:39:08 - [info] Flows file : c:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\.node-red\flows_lcjvalen-w10-1.json
util.js:256
17 May 12:39:08 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
util.js:256
17 May 12:39:08 - [info] Starting flows
util.js:256
17 May 12:39:08 - [info] Started flows
util.js:256
17 May 12:39:08 - [info] serial port COM3 opened at 57600 baud 8N1
From Electron:
17 May 12:41:13 - [info] Node-RED version: v0.20.5 17 May 12:41:13 - [info] Node.js version: v10.11.0
17 May 12:41:13 - [info] Windows_NT 10.0.17763 x64 LE
17 May 12:41:17 - [info] Loading palette nodes
17 May 12:41:19 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
17 May 12:41:19 - [warn] ------------------------------------------------------
17 May 12:41:19 - [warn] [node-red-node-serialport/serialport] Error: The module '\\?\C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\build\Release\bindings.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 64. This version of Node.js requires NODE_MODULE_VERSION 69. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`).
17 May 12:41:19 - [warn] ------------------------------------------------------
17 May 12:41:19 - [info] Context store : 'default' [module=memory]
17 May 12:41:19 - [info] User directory : C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI/.node-red/
17 May 12:41:19 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
17 May 12:41:19 - [info] Flows file : C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\.node-red\flows_lcjvalen-w10-1.json
17 May 12:41:19 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials.
You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
17 May 12:41:19 - [info] Waiting for missing types to be registered:
17 May 12:41:19 - [info] - serial-port (provided by npm module node-red-node-serialport)
17 May 12:41:19 - [info] - serial in (provided by npm module node-red-node-serialport)
17 May 12:41:19 - [info] To install any of these missing modules, run:
17 May 12:41:19 - [info] npm install <module name>
17 May 12:41:19 - [info] in the directory:
17 May 12:41:19 - [info] C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI/.node-red/
I see the error about the incorrect NODE_MODULE_VERSION compiling the @serialport module. Is that something easily fixable, or do I need to roll things back?
Googling around, it appears Electron v4.0.4 and later uses NODE_MODULE_VERSION 69 to compile the nodejs modules. I rolled the Electron version back to v4.0.3 and am now getting the following errors:
17 May 13:48:56 - [info] Node-RED version: v0.20.5
17 May 13:48:56 - [info] Node.js version: v10.11.0
17 May 13:48:56 - [info] Windows_NT 10.0.17763 x64 LE
17 May 13:48:57 - [info] Loading palette nodes
17 May 13:48:58 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
17 May 13:48:58 - [warn] ------------------------------------------------------
17 May 13:48:58 - [warn] [node-red-node-serialport/serialport] Error: Could not locate the bindings file. Tried:
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\build\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\build\Debug\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\build\Release\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\out\Debug\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\Debug\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\out\Release\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\Release\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\build\default\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\compiled\10.11.0\win32\x64\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\addon-build\release\install-root\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\addon-build\debug\install-root\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\addon-build\default\install-root\bindings.node
→ C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\node_modules\@serialport\bindings\lib\binding\node-v64-win32-x64\bindings.node
17 May 13:48:58 - [warn] ------------------------------------------------------
17 May 13:48:58 - [info] Context store : 'default' [module=memory]
17 May 13:48:58 - [info] User directory : C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI/.node-red/
17 May 13:48:58 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
17 May 13:48:58 - [info] Flows file : C:\Users\jvalentine\Documents\GitHub\pal-masking\Med EP UI\.node-red\flows_lcjvalen-w10-1.json
17 May 13:48:59 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
17 May 13:48:59 - [info] Starting flows
17 May 13:48:59 - [info] Started flows