2

Before I start creating a snap from my real application, I thought it be a good idea to start with a simple console.log app. However.....after two days I'm getting nowhere :(

I'm running Ubuntu Core (16.04) and I've created a small GitHub repo at https://github.com/wmmihaa/wmmihaa001.

These are the steps I followed:

1 I created a folder called wmmihaa001 (same as repo) and ran the following comand in classic mode:

sudo snapcraft init

2 This created a snap folder with the snapcraft.yaml file that I edited:

name: wmmihaa001
version: '0.1' 
summary: ...
description: |
  ...
grade: devel 
confinement: devmode 
parts:
  wmmihaa001:
    source: https://github.com/wmmihaa/wmmihaa001.git
    plugin: nodejs
apps:
  hello:
    command: bin/hello-wmmihaa

(the command correlates with my package.json):

...
"bin": {
  "hello-wmmihaa": "index.js"
},
...

3 Next I build the project using:

snapcraft

which outputted in:

Staging wmmihaa001
Priming wmmihaa001
Snapping 'wmmihaa001' /
Snapped wmmihaa001_0.1_amd64.snap

4 Lastly, I installed the project using:

sudo snap install --devmode wmmihaa001_0.1_amd64.snap

which returned:

wmmihaa001 0.1 installed

5 I check that my snap was installed using snap list, and sure enough, it's there:

wmmihaa001            0.1              x1               devmode

6 I exit classic mode and run wmmihaa001.hello:

admin@dell3001:~/snap$ wmmihaa001.hello
/snap/wmmihaa001/x1/bin/hello-wmmihaa: 1: /snap/wmmihaa001/x1/bin/hello-wmmihaa: Syntax error: word unexpected (expecting ")")
admin@dell3001:~/snap$

The only syntax in the file is:

console.log("Hello WMMIHAA");

Also... Sometimes after I've built the snap it doesn't get created in the ../snap folder where I can find other snaps I've build from existing samples

0

You must log in to answer this question.

Browse other questions tagged .