How to build NodeJS support without an Internet connection?

Valentin V. Bartenev vbart at nginx.com
Wed Dec 12 17:09:33 UTC 2018


On Sunday 09 December 2018 21:14:14 Valentin V. Bartenev wrote:
> On Sunday, 9 December 2018 16:41:56 MSK Ralph Seichter wrote:
> > Hello developer team.
> > 
> > I am the maintainer of the NGINX Unit ebuild for Gentoo Linux, and
> > currently I am struggling with colliding requirements of Unit's and
> > Gentoo's build strategies.
> > 
> > As you may know, the Gentoo way is to build everything from the source
> > code, with only very few exceptions. If, for example, the user desires
> > Python support in Unit, my ebuild ensures that this requirement is met
> > before Unit's release tarball is even unpacked.
> > 
> > NodeJS support is a different beast, because the existing Unit build
> > method relies on node-gyp and npm to download and install dependencies
> > during the build process. This fails, because Gentoo builds are executed
> > in a sandbox environment that prohibits both network access and files
> > being written outside the sandbox. Hence, "npm install --global ..."
> > won't do.
> > 
> > Is there a way I can modify the existing Unit build to comply with these
> > restrictions? Everything required for the build must either already
> > exist, or it must be downloaded by Gentoo before Unit's compile phase.
> > Also, all required artefacts are recorded with a checksum when an ebuild
> > is added to the Gentoo tree, so no "download whatever is the most recent
> > version of XYZ".
> > 
> > Your help is appreciated.
> 
> Hi Ralph,
> 
> Thank you for your effort.
> 
> All the Node.js module dependencies are set in its package.json file:
> http://hg.nginx.org/unit/file/tip/src/nodejs/unit-http/package.json
> 
> There's just one:
> 
>     "dependencies": {
>         "node-addon-api": "1.2.0"
>     }
> 
> and I'm not sure that it's needed at all, especially for Gentoo.
> 
> I think you can just remove it.
> 
> See also this overlay for some ideas:
> https://github.com/msva/mva-overlay/tree/master/www-servers/nginx-unit
> 
[..]

JFYI, the surplus dependency has been removed:

   http://hg.nginx.org/unit/rev/fd323ad9e24f

So, now the Node.js module has no dependencies and npm doesn't download
anything during installation.

  wbr, Valentin V. Bartenev



More information about the nginx mailing list