electron: process.windowsStore returns undefined even in AppX packages in Electron 5.0.x, 7.x, 8.x
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version:
- Tested on electron 5.0.0, through 5.0.6
- Operating System:
- Windows 10 (Tested on both 1803 and 1809)
Expected Behavior
process.windowsStore should return true if running inside of an appx package, as described in https://electronjs.org/docs/api/process#processwindowsstore
Actual Behavior
process.windowsStore returns undefined, even when running in an appx package
To Reproduce
I forked electron-quick-start to demonstrate the issue I found. https://github.com/dangeredwolf/electron-quick-start
You can then use npm run buildWindows to create the appx.
If you’re unfamiliar with appx deployment, appx files need to be signed to be installed, even in developer mode. This is basically how to do that (from Microsoft’s docs)
process.windowsStore is undefined in both the main and renderer processes when installed as an AppX
Screenshots
I set it up to throw a dialog box of whatever process.windowsStore is

It’s obvious from electron itself that it’s running from C:\Program Files\WindowsApps

Additional Information
After further testing, I confirmed that this is an issue introduced in Electron 5.0.0. You can test this by cloning the electron-quick-start fork with process.windowsStore checks and changing package.json’s "devDependencies">"electron" from "^5.0.0" to "^4.2.0"

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 39 (17 by maintainers)
This bug is too annoying. Now I use the old method to do this https://github.com/electron/electron/commit/4aaa936803ffd5f985dd0e42a7b69238f6e67a22
@gaodeng Thanks for the information, I’m able to reproduce with 8.x, it seems that 9.x is not affected by the bug.
@zcbenz @semireg if I understood correctly this happens with the Appx installed from Windows Store.
I added a PR to update the docs so we don’t have more developers going into this trap.
I think I’m getting bit with this on 8.3.0. I just published a Windows appx to Microsoft Store and users started complaining that the app was broken. I checked it out and sure enough, it’s showing as if it’s not running with windowsStore being set.
For example, because of this I’m seeing this error because electron-updater is firing up…
It also happens on Electron 8 (tried it on 8.0.1 and 8.1.1)
@zcbenz Thank you for your attention to this issue. I remember that electron v4.x and v6.x did not have this issue, v5.x v8.x process.windowsStore reported wrong results,Haven’t tried v7.x。
In an attempt to not leave a bunch of open investigations in this thread, it looks like my problem (with applying an env workaround) was twofold.
A recent change in my webpack config was preventing the most recent build of main.prod.js from being bundled into my app.
electron-log had deprecated findLogPath(). Now I’m using:
const logPath = log.transports.file.getFile().path;I’m going to submit and report back in hopefully <36 hours.
Update: Yes, my app is now in the Microsoft Store and it’s working with the env workaround described above. It really does seem like windowsStore is not behaving as it should 😞
For completeness, here’s how I tried to solve this (but still failing).
I added this to package.json:
Added to webpack.config for renderer/main:
I admit, I don’t have a good way to test my unsigned appx builds other than submitting them to the store. If I run through a mac build I can verify that setting the env in this way does show up inside the app. So the build logic is sound.
I submitted to MS store and I’m still getting the same behavior. Something else in my build is wrong. (Edit: See below, the workaround is now working for me).
Hmm, interesting! So that property is set here, and if i uncomment those conditionals it shows up correctly on
processso what that tells me is thatIsRunningInDesktopBridge()isn’t returning the correct bool value in your case. Windows isn’t my area of project expertise but I can try to dig some more 😃cc @felixrieseberg, you may have more answers here!
Let me check that for you! I haven’t noticed any issues with other variables thus far, but I’ll verify that the others work properly.
Edit: Yes, other properties from process work correctly. both in renderer and main. It is specifically the windowsStore variable that still returns undefined in an AppX.