Rails一直要求我"Please run `bundle install` before trying to start your application"



一切都很好,然后突然间我不能再运行"rails s"或"rails c"了。

我一直收到以下错误消息:

The git source https://github.com/plataformatec/devise.git is not yet checked out.
Please run `bundle install` before trying to start your application

我在网上搜索过,他们说运行:spring binstubs --all,但这不起作用,并给了我与上面相同的错误消息。

请帮忙。我做的最后一件事是把代码推送给heroku和github。Rails服务器,控制台运行良好,然后发生了这种情况。

我已经尝试运行捆绑包安装,它输出这个错误

...
Resolving dependencies...............
Bundler could not find compatible versions for gem "railties":
In snapshot (Gemfile.lock):
railties (= 5.0.4)
In Gemfile:
inherited_resources was resolved to 1.11.0, which depends on
railties (< 6.1, >= 5.2)
rails (~> 5.0.0) was resolved to 5.0.4, which depends on
railties (= 5.0.4)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

请注意,我没有对任何东西做任何更改,这就是为什么它如此奇怪。它工作了5分钟,然后突然发生了这种情况。我已经重新启动了我的Mac,问题仍然存在

从stacktrace中,我发现问题出在inherited_resources gem上。如果您查看当前使用的v1.11.0版gem的gemspec,您可以看到它在哪里明确表示railties>=5.2。但是,您似乎正在运行连接到轨道连接件5.0.4中的轨道5.0.0。

为了解决这个问题,我建议将inherited_resourcesgem修复到v1.9.0,它可以使用railties 5.0.4,然后重新运行bundle install

gem inherited_resources, "1.9.0"

我只需卸载并重新安装我的ruby并运行捆绑包安装就可以修复

rbenv uninstall  
rbenv install  
gem install bundler  
bundle install  
rails s

最新更新