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 : https://tutorials.ubuntu.com/tutorial/snap-a-website
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:
ProtonMail:
command: env TMPDIR=$XDG_RUNTIME_DIR desktop-launch $SNAP/app/ProtonMail
plugs:
- home
- x11
- unity7
- browser-support
- network
- gsettings
- pulseaudio
- opengl
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:
parts:
electron-app:
source: app/
plugin: nodejs
node-engine: '8.11.3'
... # the rest of your part definition here
well… it failed !
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