"npm ERR! code ENOTCACHED" - npm install problem with nodejs plugin

Hi,

On the Mozilla IoT team we’re trying to create a snap of our WebThings Gateway application which is built around a web server written in Node.js.

Following this tutorial we’ve got as far as the snapcraft prime step (snapcraft.yaml) but we’re having a problem with npm.

When the nodejs plugin tries to execute:

$ /root/parts/webthings-gateway/npm/bin/npm install --unsafe-perm --offline --prod

It fails with the error:

npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/@fluent%2fbundle failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-02T19_34_00_110Z-debug.log
Failed to run '/root/parts/webthings-gateway/npm/bin/npm install --unsafe-perm --offline --prod' for 'webthings-gateway': Exited with code 1.
Verify that the part is using the correct parameters and try again.

We have started to look at overriding the build step with override-build to run npm install with less caching, but it seems like that shouldn’t be necessary just to install the npm dependencies.

Any tips on how to make npm happy?

Note: We are using snapcraft 3.9, installed with $ sudo snap install --candidate snapcraft because with the current released version we got a different error.

Thanks