Failed to generate snap metadata:

I’m trying to have github.com/andreashuber69/net-worth-desktop built on build.snapcraft.io. The build fails with the following message:

npm run dist
Staging net-worth
Priming net-worth
Failed to generate snap metadata: The specified command ‘net-worth’ defined in the app ‘net-worth’ does not exist or is not executable
Build failed

I can reproduce this with snapcraft cleanbuild, but I don’t understand exactly what I can do to fix this. Running npm run dist locally (Ubuntu) produces a .snap file which can be installed and run as expected. I see that snapcraft cleanbuild performs the additional steps “staging” and “priming” (the latter of which fails), what are these good for anyway?

P.S.: I followed https://docs.snapcraft.io/build-snaps/electron on how to make snaps from an electron app.

This means that the command set in apps.net-worth.command key isn’t a valid command, check the bin and usr/bin under the prime directory and verify if the net-worth executable exist and has the executable(x) file permission.

Thanks, I still don’t understand what the staging and priming steps do and why they’re performed by snapcraft cleanbuild but not when I run npm run dist locally. Moreover, the error message seems to indicate a pretty fundamental problem, yet the locally built snap works as expected. Why is that?

When using the electron-builder you do not execute snapcraft to create the snap. As you said, running npm run build produces a .snap file. That’s all you need to do. Now you can push that to the store as is.

1 Like

Replying to myself…

The build.snapcraft.io is incompatible with electron-builder because it doesn’t use the snapcraft build mechanisms but recreates some of the functionality within electron-builder. Because of this you’ll need to use a different build server or build locally and push to the store manually.

Pinging @popey, @wimpress, @evan and @kyrofa in case they’ve worked with other electron projects, so that they may share some wisdom…

2 Likes