bundler/setup (LoadError) - ruby-on-rails

I cloned a repository and tried to run rails s. However, I received the following error:
/Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/me/workspace/bindo/config/boot.rb:7:in `<top (required)>'
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from bin/rails:9:in `<main>'
My ruby version is:
ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-darwin13.3.0]
My gem env command run from this project directory:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23.2
- RUBY VERSION: 1.9.3 (2014-05-14 patchlevel 547) [x86_64-darwin13.3.0]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /Users/me/.rbenv/versions/1.9.3-p547/bin/ruby
- EXECUTABLE DIRECTORY: /usr/lib/ruby/gems/2.0.0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /usr/lib/ruby/gems/2.0.0
- /Users/me/.gem/ruby/1.9.1
- /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I read on Stack Overflow that this is a path error, however, I am not familiar enough to figure out what to trace or change to make this work. I'm looking but I feel I need some direction.

You likely have bundler gem missing.
To get it to work run (first command may need be executed with sudo, depending on your environment):
[sudo] gem install bundler
bundle install

On the mac, it is possible that you installed gems to ./vendor/bundle
in order to avoid to use SUDO.
You can find it if you run gem install bundler and at the end of the output you see the following:
Using turbolinks-source 5.1.0
Using turbolinks 5.1.0
Using uglifier 4.1.4
Bundle complete! 13 Gemfile dependencies, 68 gems now installed.
Bundled gems are installed into `./vendor/bundle`
If this is the case than in your app root directory delete the bundle directory.
After this run the following commands:
[sudo] gem install bundler
bundle install
It solved the problem for me

Related

New Rails application bundler/setup (LoadError)

I'm getting this error when trying to create a new Rails project:
/Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:126:in require: cannot load such file -- bundler (LoadError)
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:126:in rescue in require
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in require
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/generators/app_base.rb:319:in bundle_command
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/generators/app_base.rb:335:in run_bundle
from (eval):1:in run_bundle
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in invoke_all
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in each
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in map
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in invoke_all
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in dispatch
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in start
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/application.rb:17:in <top (required)>
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in require
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in require
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/cli.rb:14:in <top (required)>
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in require
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in require
from /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/bin/rails:9:in <top (required)>
from /Users/jameslett/.rbenv/versions/2.2.2/bin/rails:23:in load
from /Users/jameslett/.rbenv/versions/2.2.2/bin/rails:23:in `<main>'
I cd'd into my project and ran bundle install and I got this error:
Errno::EACCES: Permission denied # rb_sysopen - /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.1/.autotest
An error occurred while installing nokogiri (1.6.7.1), and Bundler cannot continue. Make sure that gem install nokogiri -v 1.6.7.1 succeeds before bundling.
If I run gem install nokogirl I get the "Errno::EACCES" error again.
I'm not sure what to do to solve this. I read the Bundler and Nokogirl documentation but that hasn't helped.
Just in case, I'm running:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
My Gem ENV is:
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin14]
- INSTALLATION DIRECTORY: /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- USER INSTALLATION DIRECTORY: /Users/jameslett/.gem/ruby/2.2.0
- RUBY EXECUTABLE: /Users/jameslett/.rbenv/versions/2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /Users/jameslett/.rbenv/versions/2.2.2/bin
- SPEC CACHE DIRECTORY: /Users/jameslett/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/jameslett/.rbenv/versions/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/jameslett/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- /Users/jameslett/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
Is my gem path causing this error?
Make sure you own all the files in the .rbenv folder.
$ sudo chown -R $(whoami) /Users/jameslett/.rbenv
In addition all files should be readable and writable.
$ chmod -R u+rw /Users/jameslett/.rbenv
Permissions may be messed up when combining sudo with the actual user's environment.
You can try this
sudo gem update --system

No such file to load / Missing these required gems

I have an issue with a "missing gem".
After executing rake gems:install
>> rake gems:install
(in /some/path)
gem install google-api-client --version "= 0.7.1"
Successfully installed uuidtools-2.1.5
Successfully installed google-api-client-0.7.1
2 gems installed
Installing ri documentation for uuidtools-2.1.5...
Installing ri documentation for google-api-client-0.7.1...
Installing RDoc documentation for uuidtools-2.1.5...
Installing RDoc documentation for google-api-client-0.7.1...
Where we can see with a gem list the presence of the gem
>> gem list | grep google
google-api-client (0.7.1)
When starting my rail app I get a :
Missing these required gems:
google-api-client
You're running:
ruby 1.8.7.302 at /usr/bin/ruby1.8
rubygems 1.3.7 at /some/path/.gem/ruby/1.8, /usr/lib/ruby/gems/1.8
and then Rails advices me to execute a "rake gems:install" to solve the issue..
I only have a single version of ruby installed : ruby 1.8.7-p302
>> which ruby
/usr/bin/ruby
>> ls -l /usr/bin/ruby
lrwxrwxrwx 1 root root 7 Aug 26 2013 /usr/bin/ruby -> ruby1.8
>> ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
>> gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- 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
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I don't know where does the issue come from.
(Similarly, if I just make a ruby test file
require "rubygems"
require "google-api-client"
It outputs the same error :
>> ruby test.rb
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- google-api-client (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from test.rb:2
)
EDIT : I don't use bundle on this app.
Do you have some clue to solve this ?
Thanks !
Well, it was just the require that was erroneous
require "google/api_client"
instead of
require "google-api-client"
Thanks for the help.
You will update bundle version and then update gem.

Using PG in ruby on rails on windows [duplicate]

I'm new to Ruby (coming from a Java background) and was given access to a RoR project from a Git repository. I was able to get Ruby built with rbenv and Postgres installed via homebrew, installed the "pg" gem using the correct flags. Any ways I did "bundle install" on the project and it created a bundle, when I went to start the server:... any help will be definitely appreciated!
$ rails s
/Users//Projects/The /vendor/bundle/gems/pg-0.14.1/lib/pg.rb:4:in require': cannot load such file -- pg_ext (LoadError)
from /Users//Projects/The Usic/vendor/bundle/gems/pg-0.14.1/lib/pg.rb:4:in <top (required)>'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in block (2 levels) in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in each'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in block in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in each'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler.rb:132:in require'
Issue also appears in Fedora 17.
Uninstall "pg" gem:
gem uninstall pg
Run bundle (assuming Gemfile contains "pg" gem):
bundle
Add the pg gem to your Gemfile. Then run:
bundle install
bundle update
If during the installation of the gem the pq installation is not in path so it could not be found by the gem. Than the gem would not work correct.
Check the path (try to start psql from commandline).
uninstall the pg-gem: gem unistall pg
and reinstall it: bundle install or gem install pg
I'm curious if you installed the pg gem before or after installing postgres via brew?
If pg was installed before you installed Postgres via brew, you may need to remove it and install it again so that it's compiled against your current version of Postgres.
Side note: postgresapp is a much better alternative to installing postgres via homebrew: http://postgresapp.com/
I've already installed the pg
gem list pg
I also encountered this problem and I made it work.
First, you run the command:
$ gem install pg --pre
Successfully installed pg-0.21.0-x64-mingw32
Next, you update your Gemfile: gem 'pg', '~> 0.21.0'. That's it.
My rubygems environment are as follow:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.12
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x64-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby23-x64/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: C:/Users/armano/.gem/ruby/2.3.0
- RUBY EXECUTABLE: C:/Ruby23-x64/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby23-x64/bin
- SPEC CACHE DIRECTORY: C:/Users/armano/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x64-mingw32
- GEM PATHS:
- C:/Ruby23-x64/lib/ruby/gems/2.3.0
- C:/Users/armano/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org/

Ruby/PgSQL error on Rails start : cannot load such file -- pg_ext (LoadError)

I'm new to Ruby (coming from a Java background) and was given access to a RoR project from a Git repository. I was able to get Ruby built with rbenv and Postgres installed via homebrew, installed the "pg" gem using the correct flags. Any ways I did "bundle install" on the project and it created a bundle, when I went to start the server:... any help will be definitely appreciated!
$ rails s
/Users//Projects/The /vendor/bundle/gems/pg-0.14.1/lib/pg.rb:4:in require': cannot load such file -- pg_ext (LoadError)
from /Users//Projects/The Usic/vendor/bundle/gems/pg-0.14.1/lib/pg.rb:4:in <top (required)>'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in block (2 levels) in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in each'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in block in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in each'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler.rb:132:in require'
Issue also appears in Fedora 17.
Uninstall "pg" gem:
gem uninstall pg
Run bundle (assuming Gemfile contains "pg" gem):
bundle
Add the pg gem to your Gemfile. Then run:
bundle install
bundle update
If during the installation of the gem the pq installation is not in path so it could not be found by the gem. Than the gem would not work correct.
Check the path (try to start psql from commandline).
uninstall the pg-gem: gem unistall pg
and reinstall it: bundle install or gem install pg
I'm curious if you installed the pg gem before or after installing postgres via brew?
If pg was installed before you installed Postgres via brew, you may need to remove it and install it again so that it's compiled against your current version of Postgres.
Side note: postgresapp is a much better alternative to installing postgres via homebrew: http://postgresapp.com/
I've already installed the pg
gem list pg
I also encountered this problem and I made it work.
First, you run the command:
$ gem install pg --pre
Successfully installed pg-0.21.0-x64-mingw32
Next, you update your Gemfile: gem 'pg', '~> 0.21.0'. That's it.
My rubygems environment are as follow:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.12
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x64-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby23-x64/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: C:/Users/armano/.gem/ruby/2.3.0
- RUBY EXECUTABLE: C:/Ruby23-x64/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby23-x64/bin
- SPEC CACHE DIRECTORY: C:/Users/armano/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x64-mingw32
- GEM PATHS:
- C:/Ruby23-x64/lib/ruby/gems/2.3.0
- C:/Users/armano/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org/

RVM with ruby 1.9.2 error: no such file to load config/boot

I cannot seem to figure this out. I am new to the unix environment, so hopefully this will be an easy issue to solve. The issue is, when i'm in the home directory and any directory after, rails cannot find config/boot and I cannot run any rails commands. I tried nuking the rvm install (with rvm implode) and reinstalling it via the rvm website. These issues do not exist if I am before the home directory (ie, i am in ~/ and I cd .., then run rails -v, everything works fine)
When I'm in my home directory (~/ and beyond), I get an error when trying any rails commands (ie rails -v) (note - rvm use system rails works fine):
macbook-4:~ dannykirschner$ rails -v
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- /Users/dannykirschner/config/boot (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/rails:5:in `<main>'
It seems there is a pathing issue with boot, and I am not sure how to fix that.
More info:
macbook-4:~ dannykirschner$ which ruby
/Users/dannykirschner/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
macbook-4:~ dannykirschner$ which rails
/Users/dannykirschner/.rvm/gems/ruby-1.9.2-p180/bin/rails
macbook-4:~ dannykirschner$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.6.2
- RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
- INSTALLATION DIRECTORY: /Users/dannykirschner/.rvm/gems/ruby-1.9.2-p180
- RUBY EXECUTABLE: /Users/dannykirschner/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
- EXECUTABLE DIRECTORY: /Users/dannykirschner/.rvm/gems/ruby-1.9.2-p180/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
- /Users/dannykirschner/.rvm/gems/ruby-1.9.2-p180
- /Users/dannykirschner/.rvm/gems/ruby-1.9.2-p180#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
And to make it more puzzling, with 1.8.7, I can get the rails command to work, but only if I specify a gemset. rails is also installed in the global gemset.
macbook-4:~ dannykirschner$ rvm use 1.8.7
Using /Users/dannykirschner/.rvm/gems/ruby-1.8.7-p334
macbook-4:~ dannykirschner$ rails -v
script/rails:5:in `require': no such file to load -- /Users/dannykirschner/config/boot (LoadError)
from script/rails:5
macbook-4:~ dannykirschner$ rvm use 1.8.7#2.3.11
Using /Users/dannykirschner/.rvm/gems/ruby-1.8.7-p334 with gemset 2.3.11
macbook-4:~ dannykirschner$ rails -v
Rails 2.3.11
Any help is appreciated!

Resources