Snap build process fails when it hits MacOS specific node modules

Hi there.

I’m having trouble getting my Electron app build recently. This is my snapcraft.yml:

The build process fails with this:

Building sleek 
+ [ -n ]
+ npm install
[08/Apr/2021:06:04:42 +0000] "CONNECT HTTP/1.1" 200 35744 "-" "-"
[08/Apr/2021:06:04:43 +0000] "CONNECT HTTP/1.1" 200 29648 "-" "-"
npm ERR! notsup Unsupported platform for dmg-license@1.0.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-04-08T06_04_43_608Z-debug.log
Failed to run 'override-build': Exit code was 1.
Build failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lpbuildd/target/", line 257, in run
  File "/usr/lib/python3/dist-packages/lpbuildd/target/", line 223, in pull
  File "/usr/lib/python3/dist-packages/lpbuildd/target/", line 100, in run_build_command
    return, env=full_env, **kwargs)
  File "/usr/lib/python3/dist-packages/lpbuildd/target/", line 537, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python3.6/", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'lp-bionic-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-63057569", "build-request-timestamp": "2021-04-08T05:59:12Z", "build_url": ""}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--env', 'http_proxy=', '--env', 'https_proxy=', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy', '--', '/bin/sh', '-c', 'cd /build/sleek && linux64 snapcraft pull']' returned non-zero exit status 2.
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=lxd --series=bionic --arch=amd64 SNAPBUILD-1366043
Scanning for processes to kill in build SNAPBUILD-1366043

The whole log is here:

So apparently my app needs a module called “dmg-license” in order to build the MacOS dmg file by the Github CI process. Which works fine.

But when the Snapcraft build process tries to process the module it fails, as it is not supported for being processed in the Linux VM, which I understand. But as the Snapcraft build process does not need the module, is there a way to exclude these MacOS specific modules from being part of the Snapcraft build process?

Or in other words: How do I get my Snaps build again, it worked until recently.

Any help is appreciated!

You probably want something like this in your package.json