Skip to content

Instantly share code, notes, and snippets.

@giordanocardillo
Last active March 25, 2020 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giordanocardillo/e718419d672050c4e748773baf8f520c to your computer and use it in GitHub Desktop.
Save giordanocardillo/e718419d672050c4e748773baf8f520c to your computer and use it in GitHub Desktop.
Installing node-gyp in locale without internet

From a connected PC download

https://nodejs.org/download/release/v12.13.1/SHASUMS256.txt

https://nodejs.org/download/release/v12.13.1/node-v12.13.1-headers.tar.gz

Put the two files in a folder, then inside the folder run

npm init -y
npm install http-server
node_modules/.bin/http-server &

Now the folder is serving as local webserver.

Install gyp using this folder as mirror

NODEJS_ORG_MIRROR=http://localhost:8080 node $NODE_HOME/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js install

Now node gyp is installed, kill server and delete folder

fg then CTRL+C to kill server

rm -rf <FOLDERNAME> to remove folder

Done!

Also... a faster way is to create the following structure:

mkdir -p $HOME/.node-gyp/12.13.1
echo 9 > $HOME/.node-gyp/12.13.1/installVersion
cp -r $NODE_HOME/include $HOME/.node-gyp/12.13.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment