Nba-go (nodejs) snap failing to build

I saw an article about nba-go, a nodejs app for showing NBA football scores. Looks neat so I thought I’d test our nodejs plugin to see how it works. It fails to build. Here’s the error you get while building.

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 905 packages in 14.01s
npm --cache-min=Infinity install --global
npm ERR! path /root/build_nba-go/parts/nba-go/install/lib/node_modules/nba-go/lib/cli.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/root/build_nba-go/parts/nba-go/install/lib/node_modules/nba-go/lib/cli.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-11-07T12_28_26_448Z-debug.log

The full log it mentions is at http://paste.ubuntu.com/25910689/

Here’s the yaml:

name: nba-go
version: '0.1.8' 
summary: The finest NBA CLI
description: |
  Watch NBA live play-by-play, game preview, box score and player information 
  on your console.
  Best CLI tool for who is both a NBA fans and Engineer.
  All data comes from stats.nba.com APIs..

confinement: strict

apps:
  nba-go:
    command: nba-go
    plugs:
      - network

parts:
  nba-go:
    plugin: nodejs
    node-engine: '8.9.0'
    source: https://github.com/xxhomey19/nba-go.git
    source-tag: 'v0.1.8'

I tried without node-engine to use an older version initially, and tried building from tip of master, and with newer node. It fails the same way.

Interestingly I ran snapcraft cleanbuild --debug and while inside the lxc container I did apt install npm and npm install -g nba-go and it all installed okay. But I can’t get the snap to build.

Any suggestions welcome.

I think this is a bug in nba-go upstream. The package.json references ./lib in multiple places but that folder does not exist in the repository. It looks like the author changed those references in this commit but didn’t change the folder structure to match.

1 Like

Good spot, thanks @lucyllewy - I’ve filed an issue upstream.

@popey you’ll get the snap to build using yarn, but I’m having problems to run it.

They commented upstream that it uses yarn. Got any node app examples which use yarn I can copy?

I thought this would be an easy one :slight_smile:

I thought the same :joy:

http://paste.ubuntu.com/25912162/

It should work, but instead it does nothing…

ok, I got it:

Without devmode it gets stuck, it seems that it’s because it calls chown somewhere.

Dunno what you did but that doesn’t work here.

Pulling nba-go 
Downloading 'node-v6.10.2-linux-x64.tar.gz'[==================================================================] 100%
Downloading 'latest.tar.gz'[==================================================================================] 100%
/root/build_nba-go/parts/nba-go/npm/bin/yarn run build
yarn run v1.3.2
error Couldn't find a package.json file in "/root/build_nba-go/parts/nba-go/src"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

oh, I am running this from a clone of the repo. If you are not, then you have to change the source: . to source: https://github.com/xxhomey19/nba-go.git

1 Like

D’oh! Didn’t pay attention to that, sorry.

Your yaml doens’t seem to build for me. Are you building in cleanbuild 16.04?


> nba-go@0.1.8 clean /root/build_nba-go/parts/nba-go/src
> rimraf lib

sh: 1: rimraf: not found

npm ERR! Linux 4.13.0-16-generic
npm ERR! argv "/root/build_nba-go/parts/nba-go/install/bin/node" "/root/build_nba-go/parts/nba-go/install/bin/npm"
"run" "clean"
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! nba-go@0.1.8 clean: `rimraf lib`
npm ERR! spawn ENOENT
npm ERR!

Regardless of success or woes, mind trying a branch I have for yarn over at https://github.com/sergiusens/snapcraft/tree/nodejs-refactor ?

A devmode snap shouldn’t fail on chown. Can you elaborate?

Yes, I’ve just tested a cleanbuild in 16.04.

I’ve pushed it here:

When I install the snap with --jailmode and run something like nba-go game -d 2017/11/02, it gets stuck without printing anything.

The security scanlog prints this:

Log: auid=1000 uid=1000 gid=1000 ses=1 pid=9007 comm="node" exe="/snap/nba-go/x16/bin/node" sig=31 arch=c000003e 92(chown) compat=0 ip=0x7f18a635b2c7 code=0x0
Syscall: chown

When I install it in devmode, seccomp doesn’t print anything and the application works without problems.

Is there something else I can collect to help understanding the issue?

I’ve filed a bug because both @elopio and myself can’t get this building when it’s just a yaml with a source: upstream url rather than a fork of upstream (which works). https://bugs.launchpad.net/snapcraft/+bug/1731003

1 Like

No, the problem is understood and won’t be fixed until portions of Multiple users and groups in snaps are implemented. This is something that is roadmapped but not prioritized. I’m working on it in the background to help out, so progress is being made, albeit slowly.

The options now are:

2 Likes