Error when running cleanbuild

Hi guys,

I’m new to snaps. I’m trying to create a new snap package for an Electron app. I’ve followed this guide:

However, when it comes to running snapcraft cleanbuild I get the following error:

Failed to load plugin: properties failed to load for electron-app: Additional properties are not allowed ('apps' was unexpected)

I’ve had a look through the snapcraft.yaml and I can’t find any reference to “apps”. I’m sure I’m probably missing something obvious/stupid, so please don’t just me too much.

TIA!

Hey there @kevq, happy to help, but it’s hard to know what the problem is without first seeing your snapcraft.yaml.

That said, have you considered using electron builder or electron forge to build your snap?

1 Like

Thanks for the quick reply. I wanted to go with a snap package purely for ease of use. I have no idea how to use electron builder or electron forge. Like I said, this is completely new to me. Here is the contents of my snapcraft.yaml file:

name: fastmail # you probably want to 'snapcraft register <name>'
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Fastmail webmail client via Electron. # 79 char long summary
description: |
  Fastmail webmail client via Electron.

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

parts:
  electron-app:
    source: app/
    plugin: nodejs

    stage-packages:
      - libnotify4
      - libappindicator1
      - libxtst6
      - libnss3
      - libxss1
      - fontconfig-config
      - gconf2
      - libasound2
      - pulseaudio

    after:
      - desktop-gtk2

    build: node_modules/.bin/electron-builder
    install: |
      mkdir $SNAPCRAFT_PART_INSTALL/app
      mv dist/linux-unpacked/* $SNAPCRAFT_PART_INSTALL/app
    prime:
      - -node_modules

    apps:
      fastmail:
        command: env TMPDIR=$XDG_RUNTIME_DIR desktop-launch $SNAP/app/fastmail
        plugs:
          - home
          - x11
          - unity7
          - browser-support
          - network
          - gsettings
          - pulseaudio
          - opengl

Fair enough.

The last portion of your YAML starts like this:

apps:
  fastmail:

But it’s indented way too far. It’s currently nested under parts, but it needs to be in the root of the YAML, alongside parts.

Ok, so I’ve amended my yaml file to the following - https://pastebin.com/r3YRGPv1

But I now get the following error when I run snapcraft cleanbuild:

Issues while validating None: The 'apps/fastmail' property does not match the required schema: Additional properties are not allowed ('install', 'prime', 'after', 'stage-packages', 'build' were unexpected)

stage-packages, after, build, install, and prime are now under apps/fastmail which is wrong. They belong under parts/electron-app.

Hi there,

can anyone check my similar problem on this topic ?
I have had no answers so far and have no idea what my problem could be (i do not believe it is an indent problem like it seems to be here).

Seems to be progressing further, but I’m still getting an error unfortunately:

Pulling electron-app 
Downloading 'node-v6.11.4-linux-x64.tar.gz'[=========================================] 100%
npm --cache-min=Infinity install
npm WARN lifecycle fastmail@0.0.1~postinstall: cannot run in wd %s %s (wd=%s) fastmail@0.0.1 install-app-deps /root/build_fastmail/parts/electron-app/src
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none was installed.
npm WARN fastmail@0.0.1 No repository field.
npm --cache-min=Infinity install --global

> fastmail@0.0.1 postinstall /root/build_fastmail/parts/electron-app/install/lib/node_modules/fastmail
> install-app-deps

sh: 1: install-app-deps: Permission denied
npm ERR! Linux 4.15.0-29-generic
npm ERR! argv "/root/build_fastmail/parts/electron-app/install/bin/node" "/root/build_fastmail/parts/electron-app/install/bin/npm" "--cache-min=Infinity" "install" "--global"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! fastmail@0.0.1 postinstall: `install-app-deps`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the fastmail@0.0.1 postinstall script 'install-app-deps'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the fastmail package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     install-app-deps
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs fastmail
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls fastmail
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/build_fastmail/parts/electron-app/src/npm-debug.log
Failed to run 'npm --cache-min=Infinity install --global' for 'electron-app': Exited with code 1.
Verify that the part is using the correct parameters and try again.
Stopping local:snapcraft-remorsefully-biodynamic-brant

Here’s a link to my current yaml file: https://pastebin.com/5rEaQxq5