'Node-gyp fetches headers from internet – not allowed because of firewall rules

I am trying to setup a simple node app in docker. The app needs to install npm package ibm_db. In that installation of ibm_db, node-gyp wants to download headers file from the internet which is not allowed under company firewall rule. Downloading npm packages works fine using a proxy.

https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz failed, reason: unable to get local issuer certificate

I am unsure of the best way forward here. Is it possible to install the headers.tar manually somehow?



Solution 1:[1]

Commit the specific version of the node-{NODE_VERSION}-headers.tar.gz file that you require into the repo, and do this:

echo "---> Set tarball"
NODE_VER=v16.13.1
npm config set tarball /{YOUR_PATH}/node-${NODE_VER}-headers.tar.gz

Then proceed with your npm install as you would normally.

https://github.com/nodejs/help/issues/3686#issuecomment-1011865975

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ezAZ