How to prevent node-gyp from downloading node-headers.tar.gz and node.lib from internet?

For those running on Windows where --tarball is useless because node-gyp subsequently wants to download the node.lib file…

Here was my solution, hope to help anyone else stuck behind corporate barriers. I’m using v16.2.0 as an example, so swap with your appropriate node version.

Create a folder you’re happy to house 16.2.0 data and point to it with the terminal command. I chose %USERPROFILE%\.node-gyp\16.2.0. Doesn’t have to be in .node-gyp.

Create two subfolders within that folder: Release and src.

Download: https://nodejs.org/download/release/v16.2.0/win-x64/node.lib and https://nodejs.org/download/release/v16.2.0/node-v16.2.0-headers.tar.gz

Place node.lib in the Release subfolder.

Open the headers.tar.gz file. I used 7zip. Once inside the tar, navigate to include/node.

Extract the two .gypi files into your base folder.

Extract everything else into the src subfolder.

Run using --nodedir=%USERPROFILE%\.node-gyp\16.2.0 (or your equivalent folder if you differed from me)

Leave a Comment