0

I need to install some Ruby gems in Windows in the offline-mode (without internet). I have gem files downloaded from the other PC.

As long as the gem does not require specific options (with --), I just execute gem install somegem --local and everything is fine.

But if the gem does require those options, there is a trouble. For example, I want to install sqlite3-1.3.10.gem:

gem install sqlite3 --local -- --with-sqlite3-dir="c:\programs\sqlite"

This returns me an error:

ERROR:  While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-sqlite3-dir=c:\programs\sqlite

What is wrong?

  • ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]
  • Rails 4.2.2
retif
  • 1,495
  • 1
  • 22
  • 40
  • 1
    --platform=ruby -- --with-sqlite3-dir=C:/programs/sqlite --with-sqlite3-include=C:/programs/sqlite are you sure C:/programs/sqlite exists? Then try withour double -- -- – ares777 Jun 24 '15 at 10:43
  • @user3344236 it's not about `sqlite`, I get error `invalid option` for *any gem* install with specific options. But I tried your options - same result. – retif Jun 24 '15 at 10:47
  • I use this kind of -- --: gem install sqlite3 -- --with-sqlite3-lib=c:/ – ares777 Jun 24 '15 at 10:49
  • @user3344236 it doesn't matter, error is the same for any other gem with any other options after `--` – retif Jun 24 '15 at 10:55
  • I don't mind to ask anyway: what versions have you for gem, ruby, rails (-v) ? Have multiple installs, old one present? for me it sounds like mismatching versions. And how you manage to put dependencies at work offline? – ares777 Jun 24 '15 at 11:00
  • @user3344236 yeah, forgot to mention this. Updated the post. – retif Jun 24 '15 at 11:05
  • @user3344236 no other installs of Ruby, this is the one and only. – retif Jun 24 '15 at 11:21
  • 1
    Try putting everything after the `--` in quotes, that has been necessary for me in the past. – simonwo Jun 24 '15 at 11:55
  • @simonwo same result, unfortunately. I also removed `--` but that did not help as well. – retif Jun 24 '15 at 12:00

1 Answers1

0

Got the reason. I ran all commands in Windows PowerShell.

Now I tried to do it in usual cmd.exe - and it just worked.

Just for a case here is how I installed sqlite3.gem: followed instructions from https://stackoverflow.com/a/16023062 and executed command:

gem install sqlite3-1.3.10.gem --local --platform=ruby -- '--with-sqlite3-dir="c:/programs/sqlite" --with-sqlite3-lib="c:/programs/sqlite/.libs" --with-sqlite3-include="c:/programs/sqlite"'

Thank you for comments, they helped to correct the command.

Community
  • 1
  • 1
retif
  • 1,495
  • 1
  • 22
  • 40