Bundle Install Fails - ruby

I am getting an error while running bundle install in my rails project.
sahil#debian:~/workspace/blog$ bundle install
/usr/bin/env: ruby: No such file or directory
Ruby
sahil#debian:~/workspace/blog$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86__64-linux]
sahil#debian:~/workspace/blog$ which ruby
/home/sahil/.rvm/bin/ruby
Received the below error while installing ruby through rvm.
Error running 'env GEM_PATH=/home/sahil/.rvm/gems/ruby-2.0.0-p0:/home/sahil/.rvm/gems/ruby-2.0.0-p0#global:/home/sahil/.rvm/gems/ruby-2.0.0-p0:/home/sahil/.rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/home/sahil/.rvm/gems/ruby-2.0.0-p0 /home/sahil/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /home/sahil/.rvm/src/rubygems-2.0.3/setup.rb --verbose',
please read /home/sahil/.rvm/log/ruby-2.0.0-p0/rubygems.install.log
rvm env
sahil#debian:~$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/sahil/.rvm/gems/ruby-2.0.0-p0
- RUBY EXECUTABLE: /home/sahil/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
- EXECUTABLE DIRECTORY: /home/sahil/.rvm/gems/ruby-2.0.0-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/sahil/.rvm/gems/ruby-2.0.0-p0
- /home/sahil/.rvm/gems/ruby-2.0.0-p0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => t
rvm env looks ok. Not sure what have I missed.

please follow this basics steps for using RVM (copied from https://stackoverflow.com/a/15570121/497756):
rvm install 2.0.0
rvm use 2.0.0 --default # The default arg is needed only first time
gem install bundler
bundle install
also another answer showing more details: https://stackoverflow.com/a/10591301/497756

Related

How to change gem environment for RUBY VERSION

I'm pretty new to Ruby and pod installation. Currently I have Ruby installed through RVM. However I'd like to install a pod through bundler by bundle exec pod install.
I keep getting the following error that my current version of Ruby is different from Gemfile specified. My current version of Ruby via RVM is same with Gemfile version. (So if I do pod install it won't cause any issues).
My gem env shows different Ruby Version.
How can I go about changing that? Where does gem env live? I saw some instructions here to install a RubyGem. But I'm having trouble following this. Any advice helps!
➜ ios git:(main) bundle exec pod install
Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5
➜ ios git:(main) gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3.1
- RUBY VERSION: 2.6.8 (2021-07-07 patchlevel 205) [universal.x86_64-darwin21]
- INSTALLATION DIRECTORY: /Users/myusername/.gem
- USER INSTALLATION DIRECTORY: /Users/myusername/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /Users/myusername/.gem/bin
- SPEC CACHE DIRECTORY: /Users/myusername/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-21
- GEM PATHS:
- /Users/myusername/.gem
- /Users/myusername/.gem/ruby/2.6.0
- /Library/Ruby/Gems/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/

Ruby version and project not matching

When I run, bundle I see the following:
Your Ruby version is 2.5.0, but your Gemfile specified
2.4.0.pre.dev
my Gemfile looks like:
source 'https://rubygems.org'
ruby '2.4.0-dev'
gem 'sinatra', :github => 'sinatra/sinatra'
This is my gem env:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.12
- RUBY VERSION: 2.5.0 (2017-07-31 patchlevel -1) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/johndoe/.rbenv/versions/2.4.0-dev/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: /Users/johndoe/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /Users/johndoe/.rbenv/versions/2.4.0-dev/bin/ruby
- EXECUTABLE DIRECTORY: /Users/johndoe/.rbenv/versions/2.4.0-dev/bin
- SPEC CACHE DIRECTORY: /Users/johndoe/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/johndoe/.rbenv/versions/2.4.0-dev/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /Users/johndoe/.rbenv/versions/2.4.0-dev/lib/ruby/gems/2.5.0
- /Users/johndoe/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "-n/usr/local/bin"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/johndoe/.rbenv/versions/2.4.0-dev/bin
- /Users/johndoe/.rbenv/libexec
- /Users/johndoe/.nvm/versions/node/v8.1.4/bin
- /usr/local/sbin
- /Library/Frameworks/Python.framework/Versions/3.4/bin
- /Users/johndoe/.rbenv/shims
- /Users/johndoe/google-cloud-sdk/bin
- /Users/johndoe/Library/Python/2.7/bin
- /Users/johndoe/.rbenv/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
When I type rbenv verions this is what I see:
system
2.0.0-p247
2.3.1
* 2.4.0-dev (set by /Users/johndoe/code/projects/blog-server/.ruby-version)
With Rbenv I am specifying the ruby version I want, and I am matching this in my project's Gemfile. However, whenever I run bundle or bundle exec gem uninstall sinatra I see the above error message about my ruby version and my gemfile ruby version not matching. I also see that my Ruby version is 2.5.0, and I have no idea how that got set. Can someone help me resolve this error?
Your Ruby version is 2.5.0, but your Gemfile specified
2.4.0.pre.dev
In my bash profile, I have:
export PATH=$HOME/.rbenv/bin:$PATH
....
eval "$(rbenv init -)"
In short, I just want the shell that runs my ruby process for my blog project to use ruby version 2.4.0-dev, and I am struggling to see understand what's blocking me and how to resolve it.
UPDATE:
I also noticed something odd. My bundler version continues to point to ruby 2.5.0p-1.
## Environment
Bundler 1.15.3
Rubygems 2.6.12
Ruby 2.5.0p-1 (2017-07-31 revision 59454) [x86_64-darwin16]
Git 2.11.0
Platform x86_64-darwin-16
OpenSSL OpenSSL 1.0.2k 26 Jan 2017
```
## Gemfile
### Gemfile
```ruby
source 'https://rubygems.org'
ruby '2.4.0-dev'
gem 'sinatra', '2.0.0'
```
### Gemfile.lock
```
<No /Users/johndoe/code/projects/blog-server/Gemfile.lock found>
In a project folder run:
rbenv local 2.4.0-dev
It should do the trick. You just need to specify local ruby version for this particular project. And your global version is set to 2.5.0
The best option here, I think, is to install Ruby Version Manager (rvm).
RVM helps every ruby developer by doing exactly what you need; manage ruby version automatically as you need.
Here's the link, hope it helps;
https://rvm.io/
Cheers

bundle install using old rubygems version

I'm having what appears to be the exact same problem seen in a 1-month old question that no one has touched. I installed rbenv using homebrew, installed ruby 2.3.1 using rbenv install 2.3.1, installed jekyll and bundler using gem install jekyll and gem install bundler, then within a jekyll project, I typed bundle install. I got the error Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation. When I run gem env, I see this:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.6
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/lindsb/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/lindsb/.rbenv/versions/2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/lindsb/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/lindsb/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- /Users/lindsb/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/lindsb/.rbenv/versions/2.3.1/bin
- /usr/local/Cellar/rbenv/1.0.0/libexec
- /Users/lindsb/.local/bin
- /usr/local/sbin
- /usr/local/bin
- /Users/lindsb/.rbenv/shims
- /Users/lindsb/.local/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /Library/TeX/texbin
I don't understand why bundler complains about Rubygems being below 2.1.0 when my Rubygems version is 2.6.6.
There is a Gemfile and a Gemfile.lock in the project directory. Gemfile looks like this:
source 'https://rubygems.org'
# jekyll
gem "jekyll", "3.1.1"
gem "redcarpet"
# compiling less
gem 'therubyracer'
gem 'less'
# minifying
gem 'jekyll-press'
# octokit
gem 'octokit'
gem 'netrc'
Hi I am learing Rails and encountered the same issue and I don't know what the root cause it is. But when I try reinstall bundler again
gem install bundler
and then run
bundle install
everything goes fine now.
I don't know exactly what the issue was, but when I removed Gemfile.lock and reran bundle install everything worked fine. There were probably just some bad constraints or something in Gemfile.lock.

Properly installing Ruby and Rubygems on Ubuntu

It seems this process is far harder than it should be.
Currently, I have ruby 1.9.2 installed manually. I wanted to update this to use RVM. So I installed that successfully, and then installed 1.9.3-p0, which is in my RVM directory under /zenph/.rvm
I upgraded rubygems using http://docs.rubygems.org/read/chapter/3
And my environment shows:
rvm 1.10.0
ruby 1.9.3p0
gem 1.8.12
So, why does "gem environment" show:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.12
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i686-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.9.1
- /home/zenph/.gem/ruby/1.9.1
What can I try to resolve this?
To see which Ruby is the default one, open a terminal and use:
rvm list default
To specify a Ruby to be the default , open a terminal and use:
rvm --default use 1.9.3
Docs

Failed WATIR installation Server 2003

I had to rebuild my box and I currently am unable to install Watir.
gem install watir
ERROR: Error installing watir:
activesupport requires Ruby version >= 1.8.7.
Which would be fine if Watir was able to use Ruby 1.8.7 . I am using
ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
gem -v
1.3.7
I am not sure when this started to occur, but the documentation on the site is lacking.
On Windows XP (Professional, Version 2002, Service Pack 3, fully pathched) I have installed ruby186-26.exe from RubyForge, as suggested at watir.com/installation.
C:\>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
C:\>gem env
RubyGems Environment:
- VERSION: 0.9.4 (0.9.4)
- INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
- GEM PATH:
- c:/ruby/lib/ruby/gems/1.8
- REMOTE SOURCES:
- http://gems.rubyforge.org
Automatic RubyGems update did not work:
C:\>gem update --system
Updating RubyGems...
ERROR: While executing gem ... (Gem::RemoteSourceException)
HTTP Response 302
I have downloaded rubygems-update-1.3.7.gem from RubyForge, copied it to the folder where I have command prompt open (C:\ in this example) and installed:
C:\>gem install rubygems-update-1.3.7.gem
Successfully installed rubygems-update, version 1.3.7
Installing ri documentation for rubygems-update-1.3.7...
Installing RDoc documentation for rubygems-update-1.3.7...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README
C:\>update_rubygems
RubyGems 1.3.7 installed
...
To make sure I have the latest RubyGems:
C:\>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
- INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
- RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
- EXECUTABLE DIRECTORY: c:/ruby/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mswin32-60
- GEM PATHS:
- c:/ruby/lib/ruby/gems/1.8
- C:/Documents and Settings/Administrator/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Now Watir did not want to install:
C:\>gem install watir
ERROR: Error installing watir:
activesupport requires Ruby version >= 1.8.7.
I have installed activesupport-2.3.8 as suggested by Charley Baker, and I was able to install Watir:
C:\>gem install activesupport --version="2.3.8"
Successfully installed activesupport-2.3.8
1 gem installed
Installing ri documentation for activesupport-2.3.8...
Installing RDoc documentation for activesupport-2.3.8...
C:\>gem install watir
Successfully installed firewatir-1.6.5
Successfully installed nokogiri-1.4.3.1-x86-mswin32
Successfully installed watir-1.6.5
3 gems installed
...
I had a similar issue just now and thought I would add a comment to this issue. Our dev vm's are currently running windows 7, therefore I needed to run my command prompt as administrator for the gem installation to work correctly.

Resources