Gem install XYZ locally (no internet connection)

I need to install win32-api and antlr3 on a computer without an internet connection. If it were such a connection, I would use gem like this:

 gem install win32-api -r gem install antlr3 -r 

This will not work. So, I thought there should be a way to download the gem and install it later, but I'm not sure how I will continue.

I found the gem which operator, which seems to indicate the local location of the gem:

 c:\>gem which antlr3 c:/tools/Ruby187/lib/ruby/gems/1.8/gems/antlr3-1.8.8/lib/antlr3.rb 

however, it did not work on win32-api:

 c:\>gem which win32-api ERROR: Can't find ruby library file or shared library win32-api 

although I already installed it.

Can someone hint in the right direction to continue here?

+4
source share
3 answers

Try

gem install --local path / to / file.gem

+8
source

I had some problems with this in a virtual machine. The VM intentionally did not have access to the Internet (sneaker-net test machine), but it still had some DNS servers configured.

For instance:

 $ gem install bundler-1.7.7.gem --local ERROR: While executing gem ... (Errno::ENETUNREACH) Network is unreachable - sendto(2) for "192.168.1.10" port 53 

192.168.1.10 is the DNS server configured for VirtualBox. So I needed to comment on /etc/resolv.conf with; at the beginning of all lines. Even going to Google DNS will break it.

 ; /etc/resolv.conf nameserver 8.8.8.8 ; nope. gem install --local doesn't like it ; You will get a Network is unreachable - sendto(2) for "8.8.8.8" port 53 

If you comment out all /etc/resolv.conf, then you can install gems locally (from a file). It seems.

 $ gem install bundler-1.7.7.gem --local Successfully installed bundler-1.7.7 Parsing documentation for bundler-1.7.7 Installing ri documentation for bundler-1.7.7 Done installing documentation for bundler after 4 seconds WARNING: Unable to pull data from 'https://rubygems.org/': no such name (https://rubygems.org/specs.4.8.gz) 1 gem installed 

Ruby gems version: 2.4.4 on Ruby 2.1.5.

+1
source

gem will first look in the current directory after .gem files. Try downloading the .gem files from the gems that you want to install on your computer with an Internet connection (and don't forget about the dependencies), then transfer the files to another computer and run gem install xyz in the same directory where you placed the .gem files.

0
source

Source: https://habr.com/ru/post/1336446/


All Articles