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

Snap maker consistently yields source-type error #1531

Closed
3 tasks done
btbaxter opened this issue Mar 1, 2020 · 2 comments
Closed
3 tasks done

Snap maker consistently yields source-type error #1531

btbaxter opened this issue Mar 1, 2020 · 2 comments
Labels

Comments

@btbaxter
Copy link

btbaxter commented Mar 1, 2020

Preflight Checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Issue Details

  • Electron Forge Version:
    • 6.0.0-beta.50
  • Electron Version:
    • 8.0.2
  • Operating System:
    • Ubuntu 18.04.4 LTS
  • Last Known Working Electron Forge version::
    • N/A

Expected Behavior

Successful make - snap

Actual Behavior

  • Without debug: Hangs
  • With debug: Errors

To Reproduce

Minimal Test Case

  • Initialize new project (yarn create electron-app my-app)
  • Add snap maker (yarn add @electron-forge/maker-snap --dev)
  • Add debug env (export DEBUG=electron-installer-snap:*)
  • Add config for maker-snap (https://www.electronforge.io/config/makers/snapcraft)
  • Run make

Minimal Test Case Repo

https://github.com/btbaxter/electron-forge-snap

Additional Information

  • Tried on three different machines
  • Tried new package from yarn, npx, and electron-forge cli
  • Tried make using yarn, npm, and electron-forge
  • Tried with base: core18 and without
  • Tried config in package.json and forge.config.js
  • Tried with different features included/excluded
  • Tried other beta versions of electron-forge
  • Tried maker on complex and minimal apps

Similar to #1439 - had to independently install multipass. Also have to delete/purge any project multipass instances between attempts.

Everything yields the same base error -- Failed to pull source: unable to determine source type of '/home/btbaxter/my-app/out'. Check that the URL is correct or consider specifying `source-type` for this part. See `snapcraft help sources` for more information.

  • out directory contains make/snap/x64 (empty) & my-app-linux-x64 with packaged app

I know it's more likely that I'm making a fundamental mistake here, but I've read all the docs I can find, tried multiple configs, and am at a loss.

yarn run v1.22.0
$ electron-forge make
✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets: snap
⠋ Making for target: snap - On platform: linux - For arch: x64  electron-installer-snap:default_args Reading package metadata from /home/btbaxter/my-app/out/my-app-linux-x64/resources/app/package.json +0ms
  electron-installer-snap:yaml Loading YAML template /home/btbaxter/my-app/node_modules/electron-installer-snap/resources/snapcraft.yaml +0ms
⠙ Making for target: snap - On platform: linux - For arch: x64  electron-installer-snap:yaml Adding MPRIS feature +56ms
  electron-installer-snap:yaml Replacing browser-support plug with browser-sandbox +0ms
The browser-sandbox feature will trigger a manual review in the Snap store.
  electron-installer-snap:yaml Writing new YAML file /tmp/electron-snap-14202SkCOngA3xBvJ/snap/snapcraft.yaml +3ms
  electron-installer-snap:snapcraft Running '/snap/bin/snapcraft snap --target-arch=amd64 --output=/home/btbaxter/my-app/out/make/snap/x64/my-app_1.0.0_amd64.snap' in /tmp/electron-snap-14202SkCOngA3xBvJ +0ms
⠦ Making for target: snap - On platform: linux - For arch: x64Setting target machine to 'amd64'
Launching a VM.
⠸ Making for target: snap - On platform: linux - For arch: x64Failed to pull source: unable to determine source type of '/home/btbaxter/my-app/out'.
Check that the URL is correct or consider specifying `source-type` for this part. See `snapcraft help sources` for more information.
⠙ Making for target: snap - On platform: linux - For arch: x64Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
✖ Making for target: snap - On platform: linux - For arch: x64

An unhandled error has occurred inside Forge:
An error occured while making for target: snap
Command failed with a non-zero return code (2):
/snap/bin/snapcraft snap --target-arch=amd64 --output=/home/btbaxter/my-app/out/make/snap/x64/my-app_1.0.0_amd64.snap
Error: Command failed with a non-zero return code (2):
/snap/bin/snapcraft snap --target-arch=amd64 --output=/home/btbaxter/my-app/out/make/snap/x64/my-app_1.0.0_amd64.snap
    at ChildProcess.<anonymous> (/home/btbaxter/my-app/node_modules/@malept/cross-spawn-promise/src/index.ts:114:16)
    at ChildProcess.emit (events.js:321:20)
    at ChildProcess.EventEmitter.emit (domain.js:485:12)
    at maybeClose (internal/child_process.js:1026:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@btbaxter btbaxter added the bug label Mar 1, 2020
@malept
Copy link
Member

malept commented Mar 3, 2020

I can't reproduce this on either Travis CI or GitHub Actions:

https://travis-ci.org/malept/electron-forge-demo123/jobs/657649048
https://github.com/malept/electron-forge-demo123/runs/481764099?check_suite_focus=true

Although I had a look at your package.json and it's odd that @electron-forge/maker-snap is in dependencies instead of devDependencies.

@btbaxter
Copy link
Author

btbaxter commented Mar 3, 2020

tl;dr - My fault. Snapcraft was setup incorrectly.

Thanks for your help with this. Just having access to that Travis CI instance gave me a starting point for troubleshooting. I worked backwards, getting my own minimal demo running through Travis CI before moving back to my local machine.

The root of the problem was my unfamiliarity with snap & snapcraft. I installed snapcraft using the instructions on snapcraft.io. Those instructions tell you to install snapcraft through snap. And, based on a multipass error, I had a global instance of multipass installed (through snap) on a couple of the test machines. After purging both of those installs entirely from snap and simply installing snapcraft (and dependencies) through apt, things cleared up.

(And the @electron-forge/maker-snap dependency/dev-dependency mistake was just from rushing to deploy the minimal demo. I thought I had fixed the issue prior to publishing. Sorry.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants