I ran into this as well. So, when we use the nodejs plugin,
unless we specify a node version greater than 7.x , the bundled npm version is 3.x
some dependencies, need npm 5 and later.
Now, as soon as snapcraft finds a package,json
, it starts installing all listed dependencies.
The only option as of now, is for the developer to have a prepare
scriptlet to run before a build
where, he runs npm cache clean --force
, npm install -g npm
, npm update
and npm rebuild
.
followed by , rm -rf node_modules
and npm install
Now the problem is, the entire dependency chain is being installed twice.
nodejs and npm dependencies, are famous for being extremely picky , moody and extremely slow to install.
In cases where the package.json is huge, the time taken for an avg npm install to complete is 60 to 90 minutes.
This is kind of avoidable isn’t it?
would be great, if snapcraft, can run npm install -g npm
and npm update -g npm
and npm rebuild
before it attempts to install in the first place.
In my case, It also required an electron rebuild everytime npm install
happened, so I was looking at build times upwards of 100 to 120 minutes for 1 run. Actual times were 200 minutes on avg (network/host issues accounted too)