使用 rake 命令在 rails 中创建数据库

DB creation in rails using the rake command

我正在尝试创建一个测试数据库。 我使用了以下命令:

  rake db:schema:create

也尝试了各种版本的代码如

sudo bundle exec rake db:create

我一直收到同样的错误:

rake aborted!
LoadError: no such file to load -- bundler/setup
/home/eshel/test/test_db/config/boot.rb:4:in `<top>'
/home/eshel/test/test_db/config/application.rb:1:in `<top>'
/home/eshel/test/test_db/config/application.rb:1:in `<top>'
/home/eshel/test/test_db/Rakefile:1:in `(root)'
/home/eshel/test/test_db/Rakefile:5:in `(root)'
(See full trace by running task with --trace)

尝试多次安装捆绑包,但到目前为止没有任何效果。

我错过了什么?

尝试以下操作:

gem install bundler
bundle install
rake db:create