Cannot start Rails Server, "no such file to load -- bundler/setup" - ruby-on-rails

var/www/amidev/config/boot.rb:6:in `require': no such file to load -- bundler/setup (LoadError)
from /var/www/amidev/config/boot.rb:6:in `<top (required)>'
from script/rails:5:in `require'
from script/rails:5:in `<main>'
I have got the following error and cannot find solution to fix it ?
Please advise.

You need to install the bundler gem.
To do that, just run gem install bundler and try again.

Make sure you are executing whatever command you are executing here with "bundle exec".
For instance:
bundle exec rake -T
instead of:
rake -T
Source: http://gembundler.com/

Related

cannot load such file -- bundler (LoadError)

I am trying to setup my database for Heroku. I've tried gem install bundler/ bundle install and that installs fine. However I still get this error. Any advice? Thanks!
heroku run rake db:migrate
Running rake db:migrate on ⬢ mycapstoneeventbrighter... up, run.2960
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /app/bin/spring:8:in `<top (required)>'
from /app/bin/rake:3:in `load'
from /app/bin/rake:3:in `<main>'

Prepending `bundle exec` to your command may solve this rails

I am having an issue while deploying my site to AWS.
Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this.
/var/app/ondeck/config/boot.rb:3:in `<top (required)>'
/var/app/ondeck/config/application.rb:1:in `<top (required)>'
/var/app/ondeck/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/var/app/ondeck/config/boot.rb:3:in `<top (required)>'
/var/app/ondeck/config/application.rb:1:in `<top (required)>'
/var/app/ondeck/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
(ElasticBeanstalk::ExternalInvocationError)
while when I do gem list rake it gives me
*** LOCAL GEMS ***
airbrake (4.3.1)
rake (10.5.0, 10.4.2)
I want to have just one version when I do bundle exec gem uninstall rake -v 10.4.2 it gives me
ERROR: While executing gem ... (Gem::InstallError)
gem "rake" cannot be uninstalled because it is a default gem
How to resolve this issue? any help will be appreciated.
First run bundle update rake .
I hope this works for you.
You need to prefix your command with bundle exec. For example, if your rake command is
rake deploy
You have instead to use
bundle exec rake deploy
Bundler will fetch the proper gem versions as listed in your Gemfile, and execute the command.

LoadError: cannot load such file --rails on 'rake db:setup'

I'm having an issue trying to switch the database in my rails app from the out of box sqlite3 to using postgres.
I've run 'gem install pg' and switched the database.yml file to new settings. Also, I've run 'bundle install' in the directory.
Now, when I run 'rake db:setup', I'm receiving this error:
$ rake db:setup
rake aborted!
LoadError: cannot load such file -- rails
/Users/aaa/Documents/Projects/sample_app/config/application.rb:3:in `require'
/Users/aaa/Documents/Projects/sample_app/config/application.rb:3:in `<top (required)>'
/Users/aaa/Documents/Projects/sample_app/Rakefile:4:in `<top (required)>'
/Users/aaa/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/Users/aaa/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
Any thoughts? Thank you in advance.
Oy, had the wrong version of rails in my gemfile.
If anyone else finds this, make sure running rails -v has your intended result! I was receiving an error when trying to see my rails version, and then changing my gemfile solved the issue.

rails console on openshift

I deployed my rails application to openshift it works well but I cannot run 'rails console' on production server. It gives me this error. How can I solve this? I tried to update rubygems but it also gives permission denied error and I couldn't make it too.
rails c error:
Warning: You're using Rubygems 1.8.24 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError)
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/commands.rb:33:in `<module:Spring>'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/commands.rb:4:in `<top (required)>'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:77:in `preload'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /var/lib/openshift/5429e72a500446dfee000197/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from -e:1:in `<main>'
rubygems-update error:
[appname.rhcloud.com repo]\> update_rubygems
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /opt/rh/ruby193/root/usr/local/share/ruby
I ran into the same issue, try running it like this:
RAILS_ENV=production bundle exec rails console
Also make sure you are running it in ~/app-root/repo when you run it
To update rubygems:
gem update --system
If that doesn't solve the problem try Spring's suggestion and run:
gem pristine --all
The problem is that there are multiple bundle executables and the system is using the wrong one.
Locate the correct bundle executable. In my case it was located at ~/.gem/bin/bundle.
If you can't find it, install it gem install bundler.
Then run ~/.gem/bin/bundle exec rails console production inside ~/app-root/repo
I couldn't get any of the gem install or bundle exec solutions to work while running the 4.1.4 Rails cartridge on OpenShift. My solution was running RAILS_ENV=production bin/rails c in app-root/repo.

Ruby:no such file to load -- coffee/rails

I am a ruby novice.I created my first ruby on rails application which named "HelloRubyWeb" on my mac.Then "cd HelloRuby",But when I input the command "rails s" ,it returned the error log:
/Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:74:in `require': no such file to load -- coffee/rails (LoadError)
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:74:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
from /Users/admin/Ruby/HelloRuby/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:53:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:53
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:50:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.7/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
Can any one help me? Very thanks.
kasperite is probably right, in the terminal run:
bundle then run rails s
Post the errors you get if any.
I had the same issue, but in my case it was because of the explicit coffee-rails version.
1) remove strictly set version for coffee-rails gem in Gemfile
2) run bin/bundle
3) run bin/bundle update
4) run bin/rails s
If you need explicitly set working version, just run bin/bundle show 'coffee-rails' and copy the version number from the terminal.

Resources