Skip to content
Advertisement

Installing node-gyp offline

node-gyp has millions of threads regarding offline installation issues, however, none of the solutions worked for me.
I’m trying to install node-sass-chokidar actually, which depends on node-sass and therefore depends on this package. I’m working on Ubuntu 16.04.
Due to the pc being offline, I cannot put the full log, however, in short:

...
gyp info using node@8.9.4 | linux | x64
...
gyp verb get node dir no --target version specified, falling back to hot node version: 8.9.4
...
gyp verb install version is no good; reinstalling
gyp verb ensuring nodedir is created /home/user/.node-gyp/8.9.4
gyp http GET https://node.js.org/download/release/v.8.9.4/node-v8.9.4-headers.tar.gz
...
gyp ERR! stack Error: This is most likely not a problem with node-gyp or the package itself and
gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy...
...

I’ve manually downloaded the above headers files, but I can’t seem to be able to use them.
I tried to extract the headers and then yarn add node-sass-chokidar --nodedir /path/to/headers, but without success.
I also tried with the exact path of the headers (they are nested inside the downloaded directories inside include/node/....
Another thing I attempted was to put the headers in $HOME/.node-gyp/8.9.4, which failed as well.

I wonder if I need to download the whole node source for the --nodedir path, however, I don’t think its reasonable to do such thing for a minor sass builder library… it just feels crazy.
What am I doing wrong? No matter what I do the library tries to access the internet and fails to use the headers I downloaded.

Advertisement

Answer

Sad truth was that I missed the installVersion file which wasn’t present in the headers download.
Once I extracted the headers to ~/.node-gyp and added an installVersion file containing 9, the installation worked.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement