I ran into the following error while trying to run my electron app that contains my express app.
Error: Could not locate the bindings file. Tried:
I think the issue has to do with serialport
module, for without it being required everything works fine.
C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesbindingsbindings.js:91
<br>Error: Could not locate the bindings file. Tried:
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportbuildserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportbuildDebugserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportbuildReleaseserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportoutDebugserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportDebugserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportoutReleaseserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportReleaseserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportbuilddefaultserialport.node
<br> → C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportcompiled6.3.1win32ia32serialport.node
<br> at bindings (C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesbindingsbindings.js:88:9)
<br> at Object.<anonymous> (C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportlibbindings.js:3:35)
<br></anonymous> at Module._compile (module.js:541:32)
<br> at Object.Module._extensions..js (module.js:550:10)
<br> at Module.load (module.js:458:32)
<br> at tryModuleLoad (module.js:417:12)
<br> at Function.Module._load (module.js:409:3)
<br> at Module.require (module.js:468:17)
<br> at require (internal/module.js:20:19)
<br> at Object.<anonymous> (C:UsersJonathanDesktopclient<NAME>electron-with-expressexpress-appnode_modulesserialportlibserialport.js:15:25)
asked Aug 17, 2016 at 16:45
code_legendcode_legend
3,46713 gold badges48 silver badges94 bronze badges
You need to rebuild the serialport module as it uses different V8 headers than Electron.
First you will need to set up a node-gyp toolchain (https://github.com/nodejs/node-gyp)
Next, install any version of Visual Studio.
Open a command window and change directory to node_modules/serialport within your project.
Enter this command with the appropriate variables:
node-gyp rebuild --target=<electron_version> --arch=<arch> --dist-url="https://atom.io/download/atom-shell" --msvs_version=<visual_studio_year>
For an example this is the command I use when rebuilding:
node-gyp rebuild --target=1.2.5 --arch=x64 --dist-url="https://atom.io/download/atom-shell" --msvs_version=2013
answered Aug 18, 2016 at 16:06
0
I had a similar problem. My solution: I got more specific about which version of nodejs I was using. I had the latest release (at this writing) 13.8 and I had the same problems as the OP.
So I installed nvm and started using it to pick my nodejs.
$ nvm install --lts
$ nvm use --lts
Now using node v12.16.0
The current Long Term Support version (at this writing) is 12.6. I redid npm install
for the app and after that I had no problems with the serial port. Theoretically, I could have kept nvm’installing different version of nodejs until I got the one that worked.
answered Feb 14, 2020 at 4:43
dogatonicdogatonic
2,5881 gold badge22 silver badges14 bronze badges
I had a problem that threw a Could not locate the bindings file
error after merging package updates via Dependabot, and running npm audit fix
.
My fix was running npm ci
.
answered Jul 11, 2021 at 12:11
Brian ZelipBrian Zelip
2,7393 gold badges31 silver badges44 bronze badges
You need to rebuild the serialport module as it uses different V8 headers than Electron.
First you will need to set up a node-gyp toolchain (https://github.com/nodejs/node-gyp)
Next, install any version of Visual Studio.
Open a command window and change directory to node_modules/serialport within your project.
Enter this command with the appropriate variables:
node-gyp rebuild --target=<electron_version> --arch=<arch> --dist-url="https://atom.io/download/atom-shell" --msvs_version=<visual_studio_year>
For an example this is the command I use when rebuilding:
node-gyp rebuild --target=1.2.5 --arch=x64 --dist-url="https://atom.io/download/atom-shell" --msvs_version=2013
I had a similar problem. My solution: I got more specific about which version of nodejs I was using. I had the latest release (at this writing) 13.8 and I had the same problems as the OP.
So I installed nvm and started using it to pick my nodejs.
$ nvm install --lts
$ nvm use --lts
Now using node v12.16.0
The current Long Term Support version (at this writing) is 12.6. I redid npm install
for the app and after that I had no problems with the serial port. Theoretically, I could have kept nvm’installing different version of nodejs until I got the one that worked.
I had a problem that threw a Could not locate the bindings file
error after merging package updates via Dependabot, and running npm audit fix
.
My fix was running npm ci
.
Tags:
Serial Port
Node.Js
Express
Npm
Electron
Related
Error: Could not locate the bindings file. Tried: → C:codexxxnode_modulesdeasyncbuilddeasync.node → C:codexxxnode_modulesdeasyncbuildDebugdeasync.node → C:codexxxnode_modulesdeasyncbuildReleasedeasync.node → C:codexxxnode_modulesdeasyncoutDebugdeasync.node → C:codexxxnode_modulesdeasyncDebugdeasync.node → C:codexxxnode_modulesdeasyncoutReleasedeasync.node → C:codexxxnode_modulesdeasyncReleasedeasync.node → C:codexxxnode_modulesdeasyncbuilddefaultdeasync.node → C:codexxxnode_modulesdeasynccompiled8.1.3win32x64deasync.node at bindings (C:codexxxnode_modulesbindingsbindings.js:88:9) at C:codexxxnode_modulesdeasyncindex.js:34:32 at Object.<anonymous> (C:codexxxnode_modulesdeasyncindex.js:76:2) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxnode_modulesnode-etcdlibclient.js:7:11) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxnode_modulesnode-etcdlibindex.js:9:10) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxnode_modulesxx1-modelscommonetcd_config.js:3:12) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxnode_modulesxx1-modelsindex.js:18:15) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxservermodulesbaseModule.js:4:14) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxservermodulesactEntityModule.js:5:12) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxservercontrollersactEntityController.js:2:11) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxserverroutesactShowRoute.js:1:89) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxserverapp.js:41:20) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) 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 Object.<anonymous> (C:codexxxserver.js:6:11) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Function.Module.runMain (module.js:605:10) at startup (bootstrap_node.js:158:16) at bootstrap_node.js:575:3