Electron-rebuild fails to find `node` binary when using nodejs plugin

I’ve got a Google Play Music Desktop Player snap. It’s currently a version behind upstream (4.4.1 vs 4.5.0) because of a problem with MPRIS integration in the later builds.

As a part of debugging that, I tried to switch from the gulp plugin to the nodejs plugin so that I can use yarn (which is what upstream uses to build), but it seems that electron-rebuild fails to find the node binary when using the nodejs plugin (both with and without the yarn package manager).

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! google-play-music-desktop-player@4.5.0 postinstall: `electron-rebuild --types=prod,optional`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the google-play-music-desktop-player@4.5.0 postinstall script.

and with yarn:

[4/4] Building fresh packages...
[1/12] ⠈ electron
[-/12] ⠈ waiting...
[-/12] ⠈ waiting...
[-/12] ⠁ waiting...
error /root/build_google-play-music-desktop-player/parts/google-play-music-desktop-player/src/node_modules/google-play-music-desktop-player: Command failed.
Exit code: 127
Command: electron-rebuild --types=prod,optional
Arguments:

The working snapcraft.yaml is here; the broken one is here.

Log of failed build with yarn
Log of failed build with default package manager

Has anyone seen this before, and if so, what did you do to resolve it?

(Post split to avoid two-link limit for new users)

It looks like a permission problem - your build is unable to execute electron-rebuild.

From your logs:

sh: 1: electron-rebuild: Permission denied