user1532587
user1532587

Reputation: 1023

Cannot run serialport on windows 10

I'm developing an electron app and after several atempts I got stucked in this. The browser inspector returns the below error when loading serialport.

Uncaught Error: Error en una rutina de inicialización de biblioteca de vínculos dinámicos (DLL).
\\?\C:\Users\Administracion\Desktop\manu\Sistemas\recargas_ussd\node_modules\serialport\build\Release\serialport.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at bindings (C:\Users\Administracion\Desktop\manu\Sistemas\recargas_ussd\node_modules\bindings\bindings.js:81:44)
    at Object.<anonymous> (C:\Users\Administracion\Desktop\manu\Sistemas\recargas_ussd\node_modules\serialport\lib\bindings\win32.js:2:36)

In order to use it, I've built it from source using:

npm install --global --production windows-build-tools

Since this wasn't enough, installed manually https://www.microsoft.com/en-us/download/confirmation.aspx?id=40760 And lately:

npm config set msvs_version 2015
npm install --save --build-from-source serialport

This allows me to build serialport. However I'm still not able to use it.

Upvotes: 1

Views: 1174

Answers (1)

user1532587
user1532587

Reputation: 1023

I was able to run it using:

npm install --save-dev electron-rebuild

Adding this to package.json

"scripts": {
  "rebuild": "electron-rebuild -f -w yourmodule"
}

And running

npm run rebuild

Upvotes: 1

Related Questions