Installing Ruby on Rails: -bash: bundle: command not found - ruby-on-rails

Having an issue running bundle in my application, I have copied the commands and logs, and display below.
$ cd ~/Desktop/chinook/
$ rake db:setup
rake aborted!
Gem::LoadError: You have already activated rake 11.1.2, but your Gemfile requires rake 10.4.2. Prepending `bundle exec` to your command may solve this.
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:34:in `block in setup'
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:19:in `setup'
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/setup.rb:8:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/config/boot.rb:4:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/config/application.rb:1:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/Users/kexinwu/Desktop/chinook/config/boot.rb:4:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/config/application.rb:1:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Then after seeing that error I ran this command:
$ gem install rake -v 10.4.2
WARNING: You don't have /Users/kexinwu/bin in your PATH,
gem executables will not run.
Successfully installed rake-10.4.2
Parsing documentation for rake-10.4.2
Done installing documentation for rake after 1 seconds
1 gem installed
Kexins-MacBook-Pro:chinook axiner$ rake db:setup
rake aborted!
Gem::LoadError: You have already activated rake 11.1.2, but your Gemfile requires rake 10.4.2. Prepending `bundle exec` to your command may solve this.
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:34:in `block in setup'
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:19:in `setup'
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'
/Users/kexinwu/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/setup.rb:8:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/config/boot.rb:4:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/config/application.rb:1:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/Users/kexinwu/Desktop/chinook/config/boot.rb:4:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/config/application.rb:1:in `<top (required)>'
/Users/kexinwu/Desktop/chinook/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
$ bundle exec rake db:setup
-bash: bundle: command not found
How do I fix this error where I can run rake db:setup?

You need to install bundler, then you can use the bundle command.
gem install bundler

Try this command bundle exec
bundle exec rake db:setup

Related

db:migrate not working after cloning the source code

i cloned the sample app from https://bitbucket.org/railstutorial/sample_app_4th_ed and followed the instruction there, but rails db:migrate is aborting
C:\Sites\sample_app>rails db:migrate
rails aborted!
LoadError: cannot load such file -- bcrypt_ext
C:/Sites/sample_app/config/application.rb:7:in `<top (required)>'
C:/Sites/sample_app/Rakefile:4:in `require_relative'
C:/Sites/sample_app/Rakefile:4:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
Caused by:
LoadError: cannot load such file -- 2.3/bcrypt_ext
C:/Sites/sample_app/config/application.rb:7:in `<top (required)>'
C:/Sites/sample_app/Rakefile:4:in `require_relative'
C:/Sites/sample_app/Rakefile:4:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
(See full trace by running task with --trace)
Try to uninstall bcrypt completely with:
gem uninstall bcrypt-ruby
gem uninstall bcrypt
Be sure all versions are uninstalled, then run
gem install bcrypt --platform=ruby
Try to run bundle install. After this worked you could try to run rake db:migrate again.

Incompatible library version puma_http11.so

When I am running rake db:create in my ruby on rails project it's giving me error LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
Here is full error
tps#tps-H81M-S1:~/sites/my_app$ rake db:create
rake aborted!
LoadError: incompatible library version - /home/tps/.rvm/gems/ruby- 2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/server.rb:15:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma- 3.6.0/lib/puma/server.rb:15:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `<top (required)>'
/home/tps/sites/my_app/config/application.rb:7:in `<top (required)>'
/home/tps/sites/my_app/Rakefile:4:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
Can anyone please help me?
Thanks in advance
Try this(version 3.6.0):
gem uninstall puma
and
bundle
or try this
gem pristine --all
or for specific gem
gem pristine puma

migration error with rake db:migrate

I created a new model, but when I run the rake db: migrate command, it shoots me the following error:
rake aborted!
Gem::LoadError: You have already activated rake 10.4.0, but your Gemfile requires rake
10.3.2. Prepending `bundle exec` to your command may solve this.
/Users/yedidyaweiner/projects/music-app/config/boot.rb:4:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/config/application.rb:1:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/Users/yedidyaweiner/projects/music-app/config/boot.rb:4:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/config/application.rb:1:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
What am I doing wrong?
use
bundle exec rake db:migrate
You can also update your gems by running
bundle update
Execute the below commands
a) delete your Gemfile.lock file
b)bundle install
It should update Gemfile.lock with correct rake.
OR
a) gem uninstall rake -v 10.4.0
b) gem install rake -v 10.3.2
then try running 'rake db:migrate'. it should work.

rake db:migrate RoR

well i try to install gem 'omniauth-twitter', create controllers and model this way
rails g controller sessions
rails g model userGem provider:string uid:string name:string
but, in the next step when i try to do a rake db:migrate, throw this error:
rake aborted!
Gem::LoadError: You have already activated rake 10.3.2, but your Gemfile requires rake 10.2.1. Prepending `bundle exec` to your command may solve this.
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:34:in ` block in setup'
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:19:in ` setup'
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup'
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/setup.rb:7:in ` <top (required)>'
/home/salinas/blog/config/boot.rb:4:in `<top (required)>'
/home/salinas/blog/config/application.rb:1:in `<top (required)>'
/home/salinas/blog/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/home/salinas/blog/config/boot.rb:4:in `<top (required)>'
/home/salinas/blog/config/application.rb:1:in `<top (required)>'
/home/salinas/blog/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Any idea how to fix it?
Run the command as:-
bundle exec rake db:migrate
Or remove the rake 10.3.2 as:-
gem uninstall rake
Select the rake-10.3.2 to uninstall.
After removing rake 10.3.2, no need to append bundle exec.

error with rake versioning when running specs in RubyMine; can I manually edit Gemfile.lock

I started getting this error and would like a way to fix it:
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
I am running this from within RubyMine. I can see in my Gemfile.lock where it specifies 10.1.0. Can I just manually update my Gemfile.lock to 10.1.1?
If I do:
$gem list
....
rake (10.1.1, 10.1.0, 10.0.4, 0.9.2.2)
So I'm not sure why it isn't just working with 10.1.0?
Here's the full output from RubyMine:
/Users/jt/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/jt/.rvm/gems/ruby-1.9.3-p448/bin/rake spec
Testing started at 3:15 PM ...
rake aborted!
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
/Users/jt/repos/app/config/boot.rb:6:in `<top (required)>'
/Users/jt/repos/app/config/application.rb:1:in `<top (required)>'
/Users/jt/repos/app/Rakefile:5:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
(See full trace by running task with --trace)
Process finished with exit code 1
You can remove your
Gemfile.lock file
and exec
bundle update

Resources