Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable() with AppX doesn't add a registry entry #122

Open
Oxalin opened this issue Mar 21, 2024 · 10 comments · Fixed by #126
Open

Enable() with AppX doesn't add a registry entry #122

Oxalin opened this issue Mar 21, 2024 · 10 comments · Fixed by #126
Assignees
Milestone

Comments

@Oxalin
Copy link
Collaborator

Oxalin commented Mar 21, 2024

OS: Windows
Context: AppX registration on enable()

According to #111 (comment), enable() with AppX doesn't register the application as intended.

Investigate and add appropriate test coverage.

@Oxalin Oxalin self-assigned this Mar 21, 2024
@Oxalin Oxalin added this to the 6.0.0 milestone Mar 21, 2024
@Oxalin
Copy link
Collaborator Author

Oxalin commented Mar 22, 2024

If an electron app is converted to an AppX, both process.versions.electron and process.windowsStore will be defined. As of now, the logic for detecting an electron app takes precedence over the logic for an AppX in the enable() code. This needs to be revisited.

Need more info - If someone can tell me more: how is an AppX built on Electron updated? Does it update itself through update.exe or is it through the MS Store? And is there a "update.exe" file installed? @hovancik

Oxalin added a commit to Oxalin/node-auto-launch that referenced this issue Mar 22, 2024
To help solve issue 122, improve the information logged about the
app's path and any error message when registring or unregistring the
registry key.
(see Teamwork#122)

Signed-off-by: Alexandre Demers <[email protected]>
@Oxalin
Copy link
Collaborator Author

Oxalin commented Mar 22, 2024

Oh! I think I've found out why it is not working. 6.0.0-rcX tags were created, but they don't seem to contain the actual updated code... Tags were probably created to early.

Next 6.0.0-rc2 will be a major update, dropping CoffeeScript and all the other improvements.

@Oxalin Oxalin linked a pull request Mar 22, 2024 that will close this issue
@hovancik
Copy link

Thanks so much for your work! Let me know how can I test or add more information.

I updated my app via Windows Store: by creating a testing group and inviting myself, then pushing test version there.

@Oxalin Oxalin linked a pull request Apr 6, 2024 that will close this issue
@Oxalin
Copy link
Collaborator Author

Oxalin commented Apr 9, 2024

@hovancik now would be a good time to test with the just released 6.0.0-rc2 :)

@hovancik
Copy link

Great, will try. But it will take some time as I need to wait for approvals and such. Will report.

@hovancik
Copy link

Hi @Oxalin , I do not see that version on NPM: https://www.npmjs.com/package/auto-launch?activeTab=versions

and installing via github errors when used (but I think it was mentioned elsewhere that you don't plan to fix that? ):

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\node_modules\auto-launch\src\index.js from C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\app\main.js not supported.
Instead change the require of index.js in C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\app\main.js to a dynamic import() which is available in all CommonJS modules.
    at c._load (node:electron/js2c/node_init:2:13672)
    at IpcMainImpl.<anonymous> (C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\app\main.js:1463:26)
    at IpcMainImpl.emit (node:events:517:28)
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:77585)
    at WebContents.emit (node:events:517:28)

Here's my PR hovancik/stretchly#1450

@Fefedu973
Copy link

An OS update caused the package to fail working ? Many user of a software i made that use this package complain that it dosen't start on boot even though it should and it was working before and it looks like it dosen't create the registry key. Weird. Does the script need to run as admin to work ?

@Oxalin
Copy link
Collaborator Author

Oxalin commented Apr 14, 2024

An OS update caused the package to fail working ? Many user of a software i made that use this package complain that it dosen't start on boot even though it should and it was working before and it looks like it dosen't create the registry key. Weird. Does the script need to run as admin to work ?

@Fefedu973 Please, open a different issue, state the OS version and the node-auto-launch version. Also version 6.0.0 is still a RC, so you shouldn't be using it for production until it is stable.

Also, it doesn't have to do with the current issue. Issue 122 was opened because 6.0.0-rc1 was released saying it supported this new feature, but it had not been merged at that time. Now it is. So the issue you're encountering is unrelated. It may be related to a previous change in the 5.x.x branch though.

@Oxalin
Copy link
Collaborator Author

Oxalin commented Apr 14, 2024

Hi @Oxalin , I do not see that version on NPM: https://www.npmjs.com/package/auto-launch?activeTab=versions

and installing via github errors when used (but I think it was mentioned elsewhere that you don't plan to fix that? ):

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\node_modules\auto-launch\src\index.js from C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\app\main.js not supported.
Instead change the require of index.js in C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\app\main.js to a dynamic import() which is available in all CommonJS modules.
    at c._load (node:electron/js2c/node_init:2:13672)
    at IpcMainImpl.<anonymous> (C:\Program Files\WindowsApps\33881JanHovancik.stretchly_1.15.102.0_x64__24fg4m0zq65je\app\resources\app.asar\app\main.js:1463:26)
    at IpcMainImpl.emit (node:events:517:28)
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:77585)
    at WebContents.emit (node:events:517:28)

Here's my PR hovancik/stretchly#1450

I just saw that rc2 build didn't go through Npmjs' build system (there is an error next to build). I'll see what needs to be fixed.

For the ES module error/warning, it is to be expected that you'll need to change how it is imported in your application. The change shouldn't be to invasive, mostly by changing "require" for "import" with a few adjustments.

@hovancik
Copy link

Seems like Electron is not that friendly with import (https://www.electronjs.org/docs/latest/tutorial/esm) and it's not really something I understand, so I will wait for the RC on NPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment