LoadError:无法加载这样的文件 - rails db:setup'

时间:2015-12-07 14:21:15

标签: ruby-on-rails ruby postgresql

我试图将我的rails应用程序中的数据库从开箱即用的sqlite3切换到使用postgres时出现问题。

我已经运行了gem install pg'并将database.yml文件切换到新设置。另外,我已经开始运行'捆绑安装'在目录中。

现在,当我运行' rake db:setup'时,我收到此错误:

$ 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)

有什么想法?提前谢谢。

1 个答案:

答案 0 :(得分:1)

Oy,我的gemfile中有错误版本的rails。

如果有其他人发现这一点,请确保运行rails -v具有您想要的结果!我在尝试查看我的rails版本时收到错误,然后更改我的gemfile解决了这个问题。

相关问题