Version: 20.38.5
Target: Windows
@serialport/bindings version v2.0.7
I'm using proton-native, which integrates with electron-builder, and initially filed an issue there, but the author said to file an issue here instead.
Please see the issue https://github.com/kusti8/proton-native/issues/196 for screenshots of the error.
There is an example project here: https://github.com/kfatehi/proton-native-serialport-issue
After npm install just run npm run dist to create the broken exe reproducing the error.
I also cross-posted in a comment on node-serialport and got a response indicating that serialport project plans to switch to N-API in April, which may be the proper solution to this issue.
Think I have similar issue #3736
Uff I have the same issue...
I am on macOS though and I used the vue-cli plugin to start
Please try 21.0.11
Thanks for the quick reply, I was using vue-cli-plugin-electron-builder, the solution in my case was to mark serialport as external for the builder
// vue.config.js
module.exports = {
pluginOptions: {
electronBuilder: {
externals: ['serialport']
}
}
}
Hi @s00500, I encounter the same problem as you but when I apply your vue.config.js I get the following error:
App threw an error during load
Error: The module '\\?\C:\Users\Admin\projects\serial_test\node_modules\@serialport\bindings\build\Release\bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 47. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, usingnpm rebuildornpm install).
at process.func [as dlopen] (electron/js2c/asar.js:155:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:857:18)
at Object.func [as .node] (electron/js2c/asar.js:155:31)
at Module.load (internal/modules/cjs/loader.js:677:32)
at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
at Function.Module._load (internal/modules/cjs/loader.js:601:3)
at Module.require (internal/modules/cjs/loader.js:715:19)
at require (internal/modules/cjs/helpers.js:14:16)
at bindings (C:\Users\Admin\projects\serial_test\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Admin\projects\serial_test\node_modules\@serialport\bindings\lib\win32.js:1:36)
Done in 15.56s.
As I understood electron-builder will handle all the rebuilding for electron. Do you or somebody else know the answer to this error?
install electron-rebuild and run npx electron-rebuild -f -p
Most helpful comment
install electron-rebuild and run
npx electron-rebuild -f -p