Snapping Electron App : ProtonMail

Hello world !
I was trying if there was a way to make/install webapp in ubuntu and found this tutorial.
My goal was to be able to have an ‘App’ to read my emails.
So I followed all the steps of the tutorial but the cleanbuild command fails. I have no experience whatsoever in packaging/electron/snaps but have a good understanding of programing and linux in general.

Here is the yaml file and the clean built command that fails ; can someone help me out on that ?
Cheers !

$ cedc @ DellOni  ~/ProtonMail
└──▶  cat snap/snapcraft.yaml 
name: proton-mail
version: '0.1'
summary: Acess ProntonMail through a dedicated app
description: |
  Use ProtonMail services from a dedicated app instead of using your browser. 
  This snap was created using electron and Ubuntu tutorial :

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

    source: app/
    plugin: nodejs

      - libnotify4
      - libappindicator1
      - libxtst6
      - libnss3
      - libxss1
      - fontconfig-config
      - gconf2
      - libasound2
      - pulseaudio

      - desktop-gtk2

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

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

and the snapcraft command output, too long to be posted here

It looks like the build is failing because the project needs async/await support in NodeJS. The default version of NodeJS used by snapcraft is from the 6-series branch which does not support async/await.

To get support for async/await in your application, you need to tell snapcraft to install a newer version of NodeJS. As async/await arrived in the major version 8 series you probably want the latest version from that branch, which is 8.11.3. This branch is LTS so should be supported for a while yet. You can also opt to use a release from the 10-series but that branch is not LTS so you will need to be more proactive on keeping up-to-date.

Once you’ve decided on a version of NodeJS that supports everything you require you can tell snapcraft to use the correct version of NodeJS. This is done by specifying a node-engine parameter to your part:

    source: app/
    plugin: nodejs
    node-engine: '8.11.3'
    ... # the rest of your part definition here

many thanks for your info; hard to guess when you have never used nodeJS !
I am trying out this and will get back to tell you if it worked.

well… it failed ! :confused: it indeed downloaded the l8.11 version of nodejs, but …

Pulling electron-app 
Downloading 'node-v8.11.3-linux-x64.tar.gz'[==============================] 100%
npm --cache-min=Infinity install
npm WARN ProtonMail@0.1.0 No description
npm WARN ProtonMail@0.1.0 No repository field.
npm WARN ProtonMail@0.1.0 No license field.

removed 315 packages in 2.786s
npm --cache-min=Infinity install --global
+ ProtonMail@0.1.0
added 1 package in 0.211s
Preparing to build electron-app 
Building electron-app 
/bin/sh: 35: node_modules/.bin/electron-builder: not found
Failed to run 'build': Exit code was 127.
Stopping local:snapcraft-psychometrically-uncontemptible-mellissa

I have installed the electron builder with npm previously but I noticed my hard drive is completly full (from downloading node) so I guess this might be part of the problem

well, does the build actually install it in a hdden .bin under node_modules usually ? … check your prime or build directory if it is really there …

even with more space it does not work. I have the same issue.
Strange thing though :

ls app/node_modules/.bin/
build              esparse           js-yaml       rimraf        uuid
electron           esvalidate        mime          semver        which
electron-builder   extract-zip       mkdirp        sshpk-conv
electron-download  install-app-deps  nugget        sshpk-sign
electron-osx-flat  is-ci             pretty-bytes  sshpk-verify
electron-osx-sign  json5             rc            strip-indent

electron-builder seems to be present in the /app/node_modules/.din folder