Rails 5.2新项目运行rails c启动控制台时遇到奇怪的错误提示missing gems。

➜  myapp git:(master) ✗ rails c
Could not find capybara-3.4.2 in any of the sources
Run `bundle install` to install missing gems.

通过bundle info capybara发现capybara安装正常
➜ myapp git:(master) ✗ bundle info capybara
  * capybara (3.4.2)
        Summary: Capybara aims to simplify the process of integration testing Rack applications, such as Rails, Sinatra or Merb
        Homepage: https://github.com/teamcapybara/capybara
        Path: /Users/blogbin/.rvm/gems/[email protected]/gems/capybara-3.4.2

重新多次运行bundle后,运行rails c已经遇到通同样的问题。

后来想起Rails 5.2自带spring预加载机制。之前运行过rails c,中途修改过Gemfile新增一些gems,之后再运行rails c遇到上述问题。

将spring关闭

➜myapp git:(master) ✗ spring stop
Spring stopped.

最后重新运行rails c正常启动

➜myapp git:(master) ✗ rails c
Running via Spring preloader in process 30356
Loading development environment (Rails 5.2.0)
2.5.1 :001 >

Rails Spring可参考
https://github.com/rails/spring

 

打赏

Leave a Reply

Your email address will not be published. Required fields are marked *