无法运行`bundle install`并恢复我的gemlock文件

时间:2017-07-16 16:22:44

标签: ruby-on-rails ruby rubygems

我删除了我的gemlock文件,然后运行了bundle install但是出现了这些错误

  

Bundler找不到gem" railties"

的兼容版本

Gemfile中的gem列表:

coffee-rails (~> 4.2) was resolved to 4.2.2, which depends on railties (>= 4.0.0)
jquery-rails (>= 4.3.1, ~> 4.3) was resolved to 4.3.1, which depends on railties (>= 4.2.0)
material-ui (~> 0.7.3.2) was resolved to 0.7.3.2, which depends on railties (~> 4.0)
rails (~> 5.1.2) was resolved to 5.1.2, which depends on railties (= 5.1.2)
sass-rails (~> 5.0) was resolved to 5.0.6, which depends on railties (< 6, >= 4.0.0)
web-console (>= 3.3.0) was resolved to 3.5.1, which depends on railties (>= 5.0) 

我可以通过ruby -v获得ruby版本但是甚至无法通过rails -v获取我的rails版本。可能是什么问题?

1 个答案:

答案 0 :(得分:0)

更新Gemfile的rails条目:

- gem 'rails'
+ gem 'rails', '< 5.0'

您的Gemfile.lock是在Rails5时代之前创建的,因此开放式依赖很好。现在它已经解决了Rails5,强制执行railties = 5.1.2,其他所有宝石都没有准备好。