Node-serialport does not work in electron v14 or v15 #2435
-
Hi! Conditions:
First step, try to build up the app: $ ./node_modules/.bin/electron-builder
• electron-builder version=22.11.7 os=5.4.0-81-generic
• loaded configuration file=package.json ("build" field)
• electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies
To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`
• writing effective config file=builds/builder-effective-config.yaml
• rebuilding native dependencies dependencies=@serialport/[email protected] platform=linux arch=x64
• install prebuilt binary name=@serialport/bindings version=9.2.1 platform=linux arch=x64 napi=
• packaging platform=linux arch=x64 electron=14.0.0 appOutDir=builds/linux-unpacked
..... etc, all ok ..... Second: try to run the app (or builded unpacked one) and got the error: $ ./node_modules/.bin/electron ./dist/main.js
/home/project/node_modules/electron/dist/electron ./dist/main.js: symbol lookup error: /home/project/node_modules/@serialport/bindings/build/Release/bindings.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeEPKNS_9CFunctionE Solution: $ ./node_modules/.bin/electron-rebuild -f
... compilation process ...
$ ./node_modules/.bin/electron ./dist/main.js
... all ok ... If I try to $ ./node_modules/.bin/electron-rebuild -f
$ ./node_modules/.bin/electron-builder -c.npmRebuild=false After downgrading Electron to 13.3.0, all works as expected: So, is it okay that |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 4 replies
-
It took me a whole day |
Beta Was this translation helpful? Give feedback.
-
It looks like the latest version of electron has disabled some of the apis that we use (and that still work in node) we have a draft pr where we're working on shifting to the newer apis. In the meantime the latest version of electron won't work. |
Beta Was this translation helpful? Give feedback.
-
I can confirm this is related to the removal of The draft change (#2305) is currently testable on Windows, but requires further work to complete on Linux and Mac. I've just run a few tests on the Windows build and it functions correctly on Electron 14, so hopefully we can get the mac and linux side of the change completed soon. |
Beta Was this translation helpful? Give feedback.
-
A draft PR (#2305) to allow operation on Electron 14+ is now testable on all supported platforms. Please do give it a try if you are able, and let us know if you find any bugs or issues. This is a significant change to the inner workings of the package; so we really need everyone's help to test it, to make sure we can iron out any issues before we set this live |
Beta Was this translation helpful? Give feedback.
-
I also had this problem when upgrading to version Electron v15. my serialport version is v9.2.4. Has the problem been solved yet? |
Beta Was this translation helpful? Give feedback.
-
The pr is still open and needs more testing |
Beta Was this translation helpful? Give feedback.
-
@reconbot Hey! :) I pushed some workarounds to fix this problem. Tested it with 14 and 16 node.js and 15 electron. Here is my pr #2352 |
Beta Was this translation helpful? Give feedback.
-
@pungfen you can fix it locally as I did in #2352 until it merged |
Beta Was this translation helpful? Give feedback.
-
#2360 fixes ABI issues for electron 14+ released in @serialport/[email protected] |
Beta Was this translation helpful? Give feedback.
-
I've just released |
Beta Was this translation helpful? Give feedback.
-
how can i use serialport with node 14.19.0? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi all, • electron-builder version=22.4.0 os=10.0.19042 To ensure your native dependencies are always matched electron version, simply add script |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi, I'm running into an error when I package my Electron app for Raspberry Pi (armv7l). The AppImage doesn't launch so I executed it in the terminal and got this Electron version: 23.0.0 The AppImage was packaged on a raspberry pi. |
Beta Was this translation helpful? Give feedback.
[email protected]
and later works well in electron as it uses N-API. You can find the upgrade guide on our docs site. And a blog post about the changes on our open collective.