Issue with snapcraft nodejs plugin (and the local npm cache)

VanCutsem, Geoffroy geoffroy.vancutsem at intel.com
Mon Jan 30 16:01:05 UTC 2017


Hi folks,

I've hit an issue building a snap that uses the nodejs plugin. The error displayed on the console is pasted below for your convenience.

This used to work up until last Friday, then the nodejs dependency chain for one of the part got updated and a newer version of a dependency is needed (this is expressed via the package.json file). That newer version of the package was also updated recently and is available via the npm registry, but it's not seen by my build system when calling 'snapcraft'. It looks like 'npm' from the 'nodejs' plugin of snapcraft uses a local cache and indefinitely re-uses it as it's given the "--cache-min=Infinity" argument (https://github.com/snapcore/snapcraft/blob/master/snapcraft/plugins/nodejs.py#L133). Being able to re-use the npm cache is definitely desirable but never refreshing it ever is possibly not the best option for this. Is there a way for the 'nodejs' plugin to handle this more gracefully, perhaps by checking is 'npm outdated' returns any outdated package (that would be needed) and conditionally updating the packages in the dependency chain accordingly? A more brute-force approach would be to just remove that argument from the plugin.

In my case, I ended up solving the issue by called 'npm update' directly on my build machine but a more automated mechanism built into snapcraft would be nicer in my opinion.

Geoffroy

gvancuts at gvancuts-nuc:~/iot-rest-api-server$ snapcraft 
Preparing to pull meta-iot-web 
Pulling meta-iot-web 
>From https://github.com/01org/iot-rest-api-server
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Downloading 'node-v4.4.4-linux-x64.tar.gz'[===========================================================================================================================================================] 100%
npm --cache-min=Infinity install
npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/home/gvancuts/iot-rest-api-server/parts/meta-iot-web/install/bin/node" "/home/gvancuts/iot-rest-api-server/parts/meta-iot-web/install/bin/npm" "--cache-min=Infinity" "install"
npm ERR! node v4.4.4
npm ERR! npm  v2.15.1
npm ERR! code ETARGET

npm ERR! notarget No compatible version found: iotivity-node@'>=1.2.0-1 <2.0.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.9.2-0","0.9.2-1","1.0.0-0","1.0.0-1","1.0.0-2","1.0.0-3","1.0.0-4","1.0.1-0","1.0.1-1","1.1.0-1","1.1.0-2","1.1.0-3","1.1.0-4","1.1.0-5","1.1.1-0","1.1.1-1","1.1.1-2","1.1.1-3","1.2.0-0"]
npm ERR! notarget 
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'iot-rest-api-server'
npm ERR! notarget 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/gvancuts/iot-rest-api-server/parts/meta-iot-web/src/npm-debug.log
Command '['/bin/sh', '/tmp/tmpmchipfnc', 'npm', '--cache-min=Infinity', 'install']' returned non-zero exit status 1

Technical Marketing Engineer Manager
Open-Source Technology Centre
Tel: +32 (0)3 450 0851

-----------------------------------------------
Intel Corporation NV/SA
Kings Square, Veldkant 31
2550 Kontich
RPM (Bruxelles) 0415.497.718. 
Citibank, Brussels, account 570/1031255/09





More information about the Snapcraft mailing list