Ruby install gem offline in Windows - ruby

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

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.

Related

Gem install error: 'Please specify at least one gem name'

When I run 'gem install bundler' for example, it works fine if I am running ruby version 1.9.3, but when running ruby 2.1.2, it seems not to see the 'bundler' arg and gives me
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
I see this on two different systems running rbenv.
Here is the last part of the output when running with RBENV_DEBUG=1:
+ [rbenv-exec:45] export PATH=/home/ded/.rbenv/versions/2.1.2/bin:/home/ded/.rbenv /libexec:/home/ded/.rbenv/plugins/bundler/bin:/home/ded/.rbenv/plugins/ruby-build/bin:.bundle/bin:/home/ded/.rbenv/shims:/home/ded/.rbenv/bin:/home/ded/.cabal/bin:/home/ded/.emacs/ded/lisp/ecukes:/home/ded/local/node/bin:/home/ded/j64-701/bin:/home/ded/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/plan9/bin
+ [rbenv-exec:45] PATH=/home/ded/.rbenv/versions/2.1.2/bin:/home/ded/.rbenv/libexec:/home/ded/.rbenv/plugins/bundler/bin:/home/ded/.rbenv/plugins/ruby-build/bin:.bundle/bin:/home/ded/.rbenv/shims:/home/ded/.rbenv/bin:/home/ded/.cabal/bin:/home/ded/.emacs/ded/lisp/ecukes:/home/ded/local/node/bin:/home/ded/j64-701/bin:/home/ded/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/plan9/bin
+ [rbenv-exec:47] exec -a gem /home/ded/.rbenv/versions/2.1.2/bin/gem install bundler
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
Any suggestions what could be going wrong?
Changed my ~/.gemrc from
gem: --document
to
gem: --ri-document
and that solved the problem. Not sure why it was not a problem with ruby 1.9.3.
Try to uninstall all
** $ sudo gem uninstall --all**
2.try to install ruby
** $ sudo gem install ruby**
then install cocoapods then perfectly working
$ sudo gem install cocoapods

Trying to install bro pages: mime-types requires Ruby version >= 1.9.2

I've been trying to install bro pages, but I'm hitting a wall.
I've managed to upgrade to Ruby 2.1.0:
craig#Craig-loaf:~$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
craig#Craig-loaf:~$ gem -v
2.2.1
But I try to install bro pages, like so:
craig#Craig-loaf:~$ sudo gem install bropages
ERROR: Error installing bropages:
mime-types requires Ruby version >= 1.9.2.
Which to me makes no sense.
I found some where on Stackoverflow a similar problem, where another gem had issues with being installed at they recommended adding --pre --no-ri --no-rdoc to the end, but I get this error instead:
craig#Craig-loaf:~$ sudo gem install bropages --pre --no-ri --no-rdoc
[sudo] password for craig:
ERROR: Could not find a valid gem 'bropages' (>= 0) in any repository
ERROR: Possible alternatives: bropages
craig#Craig-loaf:~$ sudo gem install mime-types --pre --no-ri --no-rdoc
ERROR: Could not find a valid gem 'mime-types' (>= 0) in any repository
ERROR: Possible alternatives: mime-types
So how can I get round this, and install bropages?
Is the sudo user set up to use a different ruby version (or any ruby version at all)? I've seen this happen before on UNIX machines where the main user is configured but the sudo user isn't. For example, the way I have things set up right now, > gem install {something} works fine, but > sudo gem install {something} claims it can't find the 'gem' command.
You might also try running without sudo. I don't sudo on my Linux machine, and I'm pretty sure my Mac doesn't require me to, either.
Try running 'sudo ruby -v' and 'sudo gem -v'. If that doesn't give you what you need to solve the issue, post the output to those commands here on the thread.
I got the above mentioned errors as well
I'm using Ubuntu 12.10 64bit.
bropages requires Ruby version 1.9.2, I had 1.8.7 installed. What fixed it for me is to install the latest version of ruby and install bropages gem in that so I could use it.
Here are the steps I took to install the latest version, and specify that as the one to use and to install bropages in that.
sudo apt-get update
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails
gem install bropages
Then finally I can use is like this:
bro curl
9 entries for curl -- submit your own example with "bro add curl"
# get the contents of a web page
curl http://bropages.org
bro thanks to upvote (22)
bro ...no to downvote (2)
Source: https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
And http://bropages.org/

Why do I get "ERROR: While executing gem ... (Gem::FilePermissionError)"?

I uninstalled RVM and re-installed using a single user installation using:
\curl -L https://get.rvm.io | bash -s stable
When I do bundle, it prompts for:
Enter your password to install the bundled RubyGems to your system:
I tried using the answer in "ERROR: While executing gem … (Gem::FilePermissionError)" which did not fix it.
Then, while trying to install the gem manually, I got:
Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
then running gem install nokogiri -v '1.6.0' returned:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
I checked all the similar posts on SO, but they didn't solve the problem. What am I missing?
I spent a lot of time fixing this issue on my MacBook. The gem update --system does not work for me.
At last, putting the following code in the ~/.zshrc file and create a new zsh session works for me.
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
after you install RVM you still need few more steps:
Load RVM to the current shell:
source ~/.rvm/scripts/rvm
Usually this would not be needed if you close and open your terminal again
Install ruby:
rvm install ruby
Use ruby:
rvm use ruby
The last step is very important as your error message mentioned system ruby not the one controlled by RVM.
Make sure to update your system rubygems with this command : sudo gem update --system --no-user-install.
bundler use it instead your local version and your bundler version could be incompatible with your system rubygems.
It works for me ;)

Unable to install nokogiri using rvm, receiving "nokogiri requires Ruby version >= 1.9.2"

If I try to install nokogiri, I receive the following error:
rvmsudo gem install nokogiri
ERROR: Error installing nokogiri:
nokogiri requires Ruby version >= 1.9.2.
If I check my ruby version, it tells me I am running ruby1.9.3
ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]
If I use printenv, these are my env variables:
rvm_bin_path=/home/jenkins/.rvm/bin
GEM_HOME=/home/jenkins/.rvm/gems/ruby-1.9.3-p448#nokogiri
SHELL=/bin/bash
TERM=xterm-color
IRBRC=/home/jenkins/.rvm/rubies/ruby-1.9.3-p448/.irbrc
HUSHLOGIN=FALSE
MY_RUBY_HOME=/home/jenkins/.rvm/rubies/ruby-1.9.3-p448
USER=jenkins
rvm_path=/home/jenkins/.rvm
L1=-
rvm_prefix=/home/jenkins
MAIL=/var/mail/jenkins
PATH=/home/jenkins/.rvm/gems/ruby-1.9.3-p448#nokogiri/bin:/home/jenkins/.rvm/gems/ruby-1.9.3-p448#global/bin:/home/jenkins/.rvm/rubies/ruby-1.9.3-p448/bin:/home/jenkins/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD=/home/jenkins
LANG=C
rvm_version=1.21.3 (stable)
SHLVL=1
HOME=/home/jenkins
LOGNAME=jenkins
GEM_PATH=/home/jenkins/.rvm/gems/ruby-1.9.3-p448#nokogiri:/home/jenkins/.rvm/gems/ruby-1.9.3-p448#global
install_flag=1
RUBY_VERSION=ruby-1.9.3-p448
_=/usr/bin/printenv
I have some pretty bad luck with RVM and rather than break my entire installation, I thought I'd ask here.
Why can't I proceed with the installation of nokogiri?
I'm on Debian.
Just try gem install nokogiri as you have RVM installed. See here Installing Nokogiri for other things to install with it.
Like below :
# nokogiri requirements
sudo apt-get install libxslt-dev libxml2-dev
gem install nokogiri
See my answer here for the part ERROR: While executing gem ... (Errno::EACCES) ` Permission denied
I have added an older version of nokogiri (1.5.11) to chef cookbook and it worked fine after OR manually add it on the server:
chef_gem "nokogiri" do
action :install
version "1.5.11"
compile_time false if respond_to?(:compile_time)
end
OR
/usr/local/ruby-1.9.3-p392/bin/gem install nokogiri --version=1.5.11
(use absolute path where u see the error; means /my_path/gem install nokogiri).

how to update gem command in ubuntu?

my gem version is 1.3.5 and I can't install certain gems because of that.I tried to update the gem on my computer by
sudo update --system
and it gives me an error
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian.
RubyGems can be updated using the official
Debian repositories by aptitude or apt-get.
so according to some people, the source need to be downloads and it needs to executed by ruby. i downloaded the file, did
sudo ruby setup.rb
and it gave me
RubyGems 1.8.24 installed
== 1.8.24 / 2012-04-27
1 bug fix:
Install the .pem files properly. Fixes #320
Remove OpenSSL dependency from the http code path
RubyGems installed the following executables:
/usr/bin/gem1.8
but when I hit ruby gem -v it still gives me 1.3.5 rather than the one I installed which is 1.8.
Do I need to uninstall the older version manually? or some other thing I need to do first?
RubyGems installed the following executables: /usr/bin/gem1.8
As the line says, the name of the program is gem1.8, not gem. Ergo, you need to call
gem1.8 -v
not
gem -v
Please try make a symbolic link.
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Resources