question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Squirrel shortcut target is not correct, app launches after install but shortcut does nothing.

See original GitHub issue

Node v8.9.4 electron-forge app with default settings no asar Windows squirrel installer. May be related to #788

Issue is that when I build executable and run it, the app installs correctly and starts on first instance. When I close the app and start it again, it doesn’t work, app does not get launched.

I believe that I am handling squirrel and app.quit() events correctly:

if (require('electron-squirrel-startup')) app.quit() and


var cleanUp = function(event) {
  if (appWindow) appWindow.close()
  // app.quit()
}


app.on('before-quit', cleanUp)

The application works as expected in dev mode and also when running the packaged exe directly (before it’s packed into the squirrel installer). The problem is only apparent when running the squirrel installed application.

After doing some more research, I found that the issue is that the created shortcut points to an executable that is not inside a version folder. It’s the same problem described in this issue. electron/windows-installer#169 I’m still looking into exactly what configuration options needs to be adjusted, as I’m just using electron-forge defaults.

Squirrel logs:

2018-04-05 23:54:36> Program: Starting Squirrel Updater: --createShortcut=Boid.exe
2018-04-05 23:54:36> ApplyReleasesImpl: About to create shortcuts for Boid.exe, rootAppDir C:\Users\johnh\AppData\Local\Boid
2018-04-05 23:54:37> ApplyReleasesImpl: Creating shortcut for Boid.exe => C:\Users\johnh\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\boid\Boid.lnk
2018-04-05 23:54:37> ApplyReleasesImpl: About to save shortcut: C:\Users\johnh\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\boid\Boid.lnk (target C:\Users\johnh\AppData\Local\Boid\Boid.exe, workingDir C:\Users\johnh\AppData\Local\Boid\app-0.0.01, args , toastActivatorCSLID e3099bf4-afe1-5f9b-997e-fcd375395cff)
2018-04-05 23:54:37> ApplyReleasesImpl: Creating shortcut for Boid.exe => C:\Users\johnh\Desktop\Boid.lnk
2018-04-05 23:54:37> ApplyReleasesImpl: About to save shortcut: C:\Users\johnh\Desktop\Boid.lnk (target C:\Users\johnh\AppData\Local\Boid\Boid.exe, workingDir C:\Users\johnh\AppData\Local\Boid\app-0.0.01, args , toastActivatorCSLID e3099bf4-afe1-5f9b-997e-fcd375395cff)
2018-04-05 23:54:37> ApplyReleasesImpl: Examining Pin: File Explorer.lnk
2018-04-05 23:54:37> ApplyReleasesImpl: Examining Pin: Google Chrome.lnk
2018-04-05 23:54:37> ApplyReleasesImpl: Examining Pin: Google Keep - notes and lists.lnk
2018-04-05 23:54:37> ApplyReleasesImpl: Examining Pin: PuTTY.lnk

"forge": { "make_targets": { "win32": ["squirrel"], "darwin": ["dmg"], "linux": ["deb", "rpm"] }, "electronPackagerConfig": { "asar": false, "icon": "./logo", "packageManager": "npm", "name": "<%= productName %>" }, "electronWinstallerConfig": { "name": "<%= productName %>" }, "electronInstallerDebian": {}, "electronInstallerRedhat": {}, "github_repository": { "owner": "", "name": "" }, "windowsStoreConfig": { "packageName": "", "name": "electroboid" } }

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
jocelyn-sterickercommented, Jan 19, 2022

The wrapper was not opening my application either, when I was using this via electron-forge. Changing my app’s version in package.json from “0.0.0” to “0.0.1” resolved the issue for me. Maybe there are restrictions on the version field in the wrapper application?

1reaction
boid-comcommented, Jun 24, 2018

@robinxshooter I can confirm that this works for my app. Make sure you have the name of your app set correctly so the directory is right, print it out at runtime.

var target = path.resolve(path.dirname(process.execPath),‘…’,app- + appInfo.version,path.basename(process.execPath))

Here is my full squirrelHandler.js https://gist.github.com/Boid-John/e6348d0dbde4e6633ceb67bbb846ae54

Make sure you call it in your index.js if (require('./squirrelHandler')) app.quit()

Good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recently Active 'squirrel.windows' Questions - Stack Overflow
I am using the Electron framework to build an app on windows. I use electron-forge to make the setup.exe. My problem is the...
Read more >
Sourcetree not starting after update - Atlassian Community
I got a prompt to update to SourceTree 2.1.4.0 and after update launching sourcetree from shortcut does not start the app.
Read more >
Deploying the Microsoft Teams Desktop Client | Practical365
I then tried your PSS to install the app and when I logged in I can see the teams installer/update working in task...
Read more >
Taking a Krak at Why The GitKraken Taskbar Icon Vanished
If you look at the Target of that shortcut, you see that it points to ... that it looks like the structure of...
Read more >
Shortcut opens program, but shortcut has not target
Do you then find the exe for that program? If there is no 'Open File Location' by right clicking that program in Task...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found