I'm getting this error:
Could not find i18n-0.6.1 in any of the sources
Run bundle install to install missing gems.
When i try to run bundle install, i get this:
-bash: bundle: command not found
I have googled and tried to solve this for a while now with no hope. Please help.
Don't mess with your PATH.
Just use rbenv and ruby-build to manage and install your ruby version(s).
And then install the bundler gem and rehash.
Install rbenv (if you haven't already) as follows:
$ brew update
$ brew install rbenv ruby-build
Initialize rbenv as follows:
$ rbenv init
Install ruby-build to compile and install different versions of Ruby on UNIX-like systems:
brew install ruby-build
Install a specific ruby version, e.g., 1.9.3-p551:
$ RUBY_VERSION=1.9.3-p551
$ ruby-build $RUBY_VERSION $HOME/.rbenv/versions/$RUBY_VERSION
Verify it worked:
$ ruby --version
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-darwin14.0.0]
Set that version to be the global/default Ruby version:
$ rbenv global 1.9.3-p551
Install bundler:
$ gem install bundler
Fetching: bundler-1.7.11.gem (100%)
Successfully installed bundler-1.7.11
1 gem installed
Update rbenv:
$ rbenv rehash
Now, bundler will be available in the version of Ruby (1.9.3-p551) that you just installed.
Verify RubyGems Environment:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23.2
- RUBY VERSION: 1.9.3 (2014-11-13 patchlevel 551) [x86_64-darwin14.0.0]
- INSTALLATION DIRECTORY: /Users/lex/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /Users/lex/.rbenv/versions/1.9.3-p551/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lex/.rbenv/versions/1.9.3-p551/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/lex/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1
- /Users/lex/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- "install" => "--no-ri --no-rdoc"
- "update" => "--no-ri --no-rdoc"
- :sources => ["http://rubygems.org", "http://gems.github.com", "http://gems.rubyforge.org", "http://gemcutter.org"]
- REMOTE SOURCES:
- http://rubygems.org
- http://gems.github.com
- http://gems.rubyforge.org
- http://gemcutter.org
try to run
gem env
and then you will get something like this:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-darwin12.5.0]
- INSTALLATION DIRECTORY: /usr/local/Cellar/ruby193/1.9.3-p448/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/local/Cellar/ruby193/1.9.3-p448/bin/ruby
**- EXECUTABLE DIRECTORY: /usr/local/Cellar/ruby193/1.9.3-p448/bin**
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /usr/local/Cellar/ruby193/1.9.3-p448/lib/ruby/gems/1.9.1
- /Users/madhava/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Just add the executable directory to your PATH variable like this:
echo PATH=/usr/local/Cellar/ruby193/1.9.3-p448/bin:$PATH >> ~/.bash_profile
Reload your terminal to apply the changes and you will be set!
Seems with Sierra, you need to use this to get bundler installed:
sudo gem install bundler -n /usr/local/bin
Reference here refers to how El Cap introduced "SIP (System Integrity Protection)."
I am on Mac OS X Maverics (10.9.2)
Currently my ~/.profile file reads as follows:
# MacPorts Installer addition on 2014-02-23_at_17:28:39: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
source /usr/local/bin/virtualenvwrapper.sh
. /sw/bin/init.sh
And my PATH variable ($PATH) is set to
/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
This is what worked for me.
First I installed bundler using:
gem install bundler
However I got error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Hence I ran sudo gem install bundler and that installed bundler successfully
After that when I ran gem env I got the Executable Directory set to /usr/bin which is already part of my PATH variable. Hence I didn't make any changes to ~/.profile file.
and now I am successfully able to run bundle install.
If the path listed in Executable Directory is not included in your $PATH variable or ~/.profile file, you will have to include it.
Note that if you're using rbenv, you should probably just rbenv rehash and not mess with your PATH
Related
I install bundle by using
sudo bundle install and sudo gem install bundler
It show error
bundle: command not found
I set path like this.
export PATH=$PATH:/var/lib/gems/1.8/bin
When I run command gem environment it show like this.
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
When I run command echo $PATH it show like this.
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
How to fix error bundle: command not found ?
Simply hit the command
$gem install bundle
if the ruby version is required to updated do it separately
bundle(r) is a gem. I am guessing you have the gem not installed yet.
try
gem install bundler
Well, you're trying to install ruby as system package, and I would suggest not doing that since ruby 1.8 is very old version.
You should use rvm or rbenv instead for ruby installation.
Take a look on http://rvm.io. After rvm installed, install ruby
rvm install 2.3.1
then install bundler
gem install bundler
I followed the instructions and thoughts raised in this question: "Why do I get the error “Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2” although I have 2.2.2 installed 2"
I have the same error after problems with /User folder when a script removed the folders preceding with "." which included the .rbenv folder.
After a rebuild of rails, rbenv and such. Im still getting the error from rails
"Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2"
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/chris/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /Users/chris/.rbenv/versions/2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /Users/chris/.rbenv/versions/2.2.2/bin
- SPEC CACHE DIRECTORY: /Users/chris/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/chris/.rbenv/versions/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/chris/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- /Users/chris/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "-n/usr/local/bin"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/chris/.rbenv/versions/2.2.2/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /Users/chris/.rbenv/shims
- /Users/chris/.rbenv/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/local/mysql/bin
- /Library/PostgreSQL/9.4/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
Here is the current version:
$ rbenv versions
system
* 2.2.2 (set by /Users/chris/Dropbox/git/frontend.1/.ruby-version)
2.2.3
Current .bash_profile
PS1="\u$ "
alias ll="ls -lahG"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Library/Postg$
export PATH="$HOME/.rbenv/bin:$PATH"
I tried this:
gem install --no-ri --no-rdoc bundler
rbenv rehash
bundle --path=vendor/bundle
But it did not fix or change the error.
Your bash init script looks like you didn't finish installing rbenv correctly. First of all, it seems that you've installed rbenv with Homebrew. That's OK, but you should update it before you proceed:
brew update && brew upgrade rbenv
If you installed with Homebrew, then you don't need this line in your .bash_profile
# remove this line
export PATH="$HOME/.rbenv/bin:$PATH"
However, you need to add this line to the end of your .bash_profile:
# add this line
eval "$(rbenv init -)"
Now, open a new terminal window, then
rbenv version #=> 2.2.2
gem i bundler --no-rdoc -no-ri
which bundle #=> ~/.rbenv/shims/bundle
Now you can run bundle install in your project.
I'm trying to run
env RAILS_ENV=test bundle exec rake db:migrate
and get the following error
Your Ruby version is 2.1.7, but your Gemfile specified 2.2.3
ruby -v
gives me
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
I'm using rbenv, if that matters. rbenv versions gives the following:
system
* 2.2.3 (set by /Users/thatsme/Projects/demoproject/.ruby-version)
So I have no ruby 2.1.7 installed. Spring is not running and I've run rbenv rehash. Then bundler gem is installed.
I'm going nuts on this. Can somebody please tell me why the wrong ruby version is being used? Thanks!
Running the command below helped me somehow:
rbenv exec gem install bundler
Assumption: You are using RVM.
This means there's a ruby version installed outside of RVM.
Clear your rvm rubies by running
rvm uninstall <ruby version>
once you have uninstalled all rvm rubies do ruby -v, if this returns an output specifying a ruby version then thats the root of the problem. Uninstall it with
sudo apt-get remove ruby
Now install your rvm rubies with rvm install <ruby version> and set it as default rvm use <ruby version>
Now install bundler
gem install bundler
And do bundle install
TLDR;
Check really carefully the content of your .bash_profile or .bashrc file.
None of the answers actually solve my problem. So here's my solution.
This is the error that I got:
$ bundle install
Your Ruby version is 3.0.1, but your Gemfile specified 2.7.1
I checked my rbenv setup:
$ rbenv versions
system
2.4.1
2.5.0
2.7.0
* 2.7.1 (set by /Users/setoelka/awesome-project/.ruby-version)
3.0.1
I uninstall the wrong version to probably reveal a new error. I can just install it again later, I was thinking.
$ rbenv uninstall 3.0.1
It does reveal a new error:
$ bundle install
-bash: /Users/setoelka/.gem/ruby/3.0.0/bin/bundle: /Users/setoelka/.rbenv/versions/3.0.1/bin/ruby: bad interpreter: No such file or directory
Ok, that's strange. I can just remove the .gem directory there.
$ rm -rf ~/.gem/
Now another new error:
$ bundle install
-bash: /Users/setoelka/.gem/ruby/3.0.0/bin/bundle: No such file or directory
It seems like my PATH variable is messed up. So I do:
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 3.2.27
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-darwin20]
- INSTALLATION DIRECTORY: /Users/setoelka/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /Users/setoelka/.local/share/gem/ruby/2.7.0
- RUBY EXECUTABLE: /Users/setoelka/.rbenv/versions/2.7.1/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /Users/setoelka/.rbenv/versions/2.7.1/bin
- SPEC CACHE DIRECTORY: /Users/setoelka/.local/share/gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/setoelka/.rbenv/versions/2.7.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-20
- GEM PATHS:
- /Users/setoelka/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0
- /Users/setoelka/.local/share/gem/ruby/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/setoelka/.rbenv/versions/2.7.1/bin
- /usr/local/Cellar/rbenv/1.1.2/libexec
- /Users/setoelka/opt/anaconda3/bin
- /Users/setoelka/opt/anaconda3/condabin
- /Users/setoelka/.cargo/bin
- /Users/setoelka/.gem/ruby/3.0.0/bin
- /Users/setoelka/.nvm/versions/node/v16.5.0/bin
- /Users/setoelka/.rbenv/shims
- /Users/setoelka/.rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/Apple/usr/bin
So, it's clear I missed something when checking out my .bash_profile file. That's the problem there:
- /Users/setoelka/.gem/ruby/3.0.0/bin
That line was somehow buried under a plethora of settings inside my .bash_profile.
I had the same problem
I needed to run
bundle
to reinstall all my gems. then
bundle exec rails c
I have been trying to install bundle on arch linux while on version 1.9.3 switched using chruby. I thought chruby was the problem and a switched to rbenv but the problem persisted. I could not install gems in version 1.9.3 and then back to chruby but same isssue. Gems just domn't seem to install.
The output from running bundle is:
/opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/dependency.rb:247:in to_specs': Could not find bundler (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.5, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.5] (Gem::LoadError)
from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/dependency.rb:256:into_spec'
from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems.rb:1231:in gem'
from /home/urbanslug/.gem/ruby/1.9.1/bin/bundle:22:in'
My gem env output is:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-02-22 patchlevel 392) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/urbanslug/.gem/ruby/1.9.3
- RUBY EXECUTABLE: /opt/rubies/ruby-1.9.3-p392/bin/ruby
- EXECUTABLE DIRECTORY: /home/urbanslug/.gem/ruby/1.9.3/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/urbanslug/.gem/ruby/1.9.3
- /opt/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["https://rubygems.org/"]
- "gem" => "--user-install"
- REMOTE SOURCES:
- https://rubygems.org/
I would recommend rvm. It just makes installing/maintaining so much easier.
How did you install or setup rbenv exactly? rbenv can install and setup different ruby development environment separately, including the gem path. Assume your git and curl are working, you can use getrbenv to configure/install rbenv easily. Or you can install first without default ruby version by:
curl -sSL https://raw.githubusercontent.com/martinsteinorth/getrbenv-installer/master/bin/install.sh | bash -s -- --plugins sstephenson/ruby-build,rkh/rbenv-update
After source your profile or restart your shell, install ruby and set the default version
rbenv install 1.9.3-p551
rbenv rehash
rbenv global 1.9.3-p551
Now your bundle should work for your gems. You can also consider newer version like 2.2.2 or 2.0.0-p645. Good luck!
I use capistrano to deploy rails app. I have set up rbenv and using capistrano-rbenv in my deploy.rbfile
Error message when deploying:
Could not find rake-10.1.0 in any of the sources
Run `bundle install` to install missing gems.
On server when I run bundle install I get Could not locate Gemfile
$ gem env returns
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /home/deployer/.gem/ruby/1.9.1
- /usr/share/rubygems-integration/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
You should confirm that rake 10.1 is on the server through ssh login. It is a dependency to your process.
Rake is a gem like any other, so on the server run
gem install rake -v=10.1.0
if gem which returns nothing, then you need to first install rubygems, e.g.
apt-get install rubygems
Ensure that apt-get properly configures your PATH. You may need to re-source your .bash_profile (or whichever for your shell — or login again to get a new shell
I will update this answer if more details emerge.
I ended up removing the capistrano-rbenvgem and it finally worked out.
If you are requiring capistrano/bundler in your Capfile, be sure to specify the gemfile location in your deploy.rb:
# setup bundler
set :bundle_gemfile, -> { release_path.join('Gemfile') }
See: https://github.com/capistrano/bundler