NodeJS Windows 10 geolocation module throws error in electron when the app starts

684 views Asked by At

I was using module "@nodert-win10-rs4/windows.devices.geolocation" in an electronjs app which was working fine. Later I installed a node module and rebuilt all the modules. Now it stopped working and throwing error. The previous version of that module ( "@nodert-win10-rs4/windows.devices.geolocation") was 1.0.0, Thus I reinstalled it, new version of the module is "0.3.2" but still error. Even i tried this in fresh new electron quick start app and I see the same error. I'm adding here the screenshot of the package.json and the error. (FYI - The module is installed and rebuilt without any error although it has some warning, I've added a screenshot of the installation/built too). Really appreciate any help/suggestions.

I saw other posts with similar errors but I already took the actions mentioned there.

Thanks Musa

N.B - Cross posted here

package.json app error rebuild log

1

There are 1 answers

2
Surya On

I ran into the same issue and here is how I resolved it.

  1. Copy the windows.devices.geolocation into your electron app folder and update the dependencies to point to the location of the folder. You need to this line added to your package.json of your Electron App

"windows.devices.geolocation": "file:windows.devices.geolocation"

  1. Navigate to the newly copied folder and build your NodeRT "addon" to match your Electron version. See this post here NodeRT with Electron

    node-gyp rebuild --target=4.0.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell

  2. Run npm install at the the top level Electron app.