加载错误:无法在"rake db:setup"上加载此类文件 --rails



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

我已经运行了"geminstall-pg",并将database.yml文件切换到了新的设置。此外,我已经在目录中运行了"bundle install"。

现在,当我运行"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)

有什么想法吗?提前谢谢。

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

如果其他人发现了这一点,请确保running rails-v达到了预期效果!我在尝试查看rails版本时收到一个错误,然后更改我的gemfile解决了这个问题。

最新更新