简体   繁体   English

安装Ruby on Rails:-bash:bundle:命令未找到

[英]Installing Ruby on Rails: -bash: bundle: command not found

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 ? 如何修复可以在rake db:setup运行的错误?

您需要安装bundler ,然后可以使用bundle命令。

gem install bundler

试试这个命令bundle exec

bundle exec rake db:setup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM