Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Spawn ENOENT when running in installed Windows app #4

Closed
jdpigeon opened this issue Aug 27, 2018 · 2 comments
Closed

Spawn ENOENT when running in installed Windows app #4

jdpigeon opened this issue Aug 27, 2018 · 2 comments

Comments

@jdpigeon
Copy link
Contributor

Dealing with an issue that's only popping up on Windows 10 and the release version of an electron app that's been installed into system programs.

Uncaught Error: spawn C:\Users\jdpig\AppData\Local\Programs\BrainWaves\resources\app.asar\node_modules\noble-winrt\prebuilt\BLEServer.exe ENOENT

I've confirmed that BLEServer.exe exists at that path and that the app has read/write access to that file. I've also tried running the app as administrator and using cross-spawn instead of child-process.

I see a lot of issues out there about running spawn in Node.js successfully on Windows. However, none of the provided solutions seem to be working: nodejs/node-v0.x-archive#2318

@urish
Copy link
Owner

urish commented Aug 27, 2018

Check out the suggestions in section 2 of web-bluetooth-polyfill troubleshooting instructions

@jdpigeon
Copy link
Contributor Author

jdpigeon commented Aug 28, 2018

Wow, after about two days of detective work I figured this out.

It's nothing to do with noble-winrt. There's a tricky work around required when it comes to getting the correct path to 'unpacked' node modules in built Electron apps (the 'packed' version of the module in the asar archive can't be accessed by the system's spawn command). electron/electron#6262

My solution was to use this small package, hazardous, that checks whether a module is in the unpacked node_modules before resolving the path.

Thanks for the suggestions though, Uri! You kept my morale high 😆

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants