Error with Electron + Serialport to use Arduino

2

I'm having trouble running an application made with Electron, Serialport, and Node.Js to communicate with an Arduino.

I have the following error:

App threw an error during load
Error: Uma rotina de inicialização da biblioteca de vínculo dinâmico (DLL) falhou.
\?\c:\teste\node_modules\serialport\build\Release\serialport.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at bindings (c:\teste\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (c:\teste\node_modules\serialport\lib\bindings.js:3:35)

I have tried several solutions but none worked so far, has anyone else gone through this or do you know of a better library to use with Arduino and Electron?

    
asked by anonymous 01.10.2017 / 23:59

2 answers

1

I solved the error by adding the following in the package.json file: "install": "electron-rebuild". Here is part of the code for future reference:

"scripts": {
    "start": "electron .",
    "install": "electron-rebuild"
}
    
04.10.2017 / 17:44
1

This is caused because the module does not come with the necessary files compiled by default ...

Delete the files from the node_modules/serialport/build/Release

Then run the following command in the same directory as package.json

npm rebuild --runtime=electron --target=1.6.11 --arch=x64 --dist-url=https://atom.io/download/atom-shell

If you are using another version of electron, just change --target

    
03.10.2017 / 05:09