Bundle install尝试使用缓存文件

当我尝试进行捆绑安装时,我的gem_path和gem_home指向/ usr / local / rvm / gems /,我没有写入权限,但由于权限无效而失败。 因为这个我已经改变了两个路径到我有写访问权的本地目录。

这样做,我做一个捆绑安装,我得到:

bruno@test6:~$ bundle install Fetching gem metadata from https://rubygems.org/......... Fetching gem metadata from https://rubygems.org/.. Bundler::GemspecError: Could not read gem at /afs/varda.io/user/b/br/bruno/test6/cache/rake-10.1.0.gem. It may be corrupted. An error occurred while installing rake (10.1.0), and Bundler cannot continue. Make sure that `gem install rake -v '10.1.0'` succeeds before bundling. 

好吧,如果我做一个gem安装,它工作得很好。

但捆绑不会起作用; 即使尝试删除它抱怨的缓存文件夹。

我确实尝试过“bundle install –no-cache”,它以同样的方式失败。 (捆绑安装 – 部署工作正常)我如何让捆绑安装工作?

我花了很多时间,如果有人有任何指导,我真的很感激!

好的,首先,您可以通过使用rvm(用户安装)轻松解决所有这些问题,请参阅http://rvm.io ,如果这不是一个选项,您可以尝试使用项目特定的gem路径。 例如,我有以下捆绑器配置文件( ~/.bundle/config

 --- BUNDLE_PATH: .bundle BUNDLE_DISABLE_SHARED_GEMS: "1" 

这会导致bundler在.bundle子目录中安装所有gem(在项目文件夹中,运行bundle install )。 现在,如果你记得使用bundle exec作为你的垃圾箱(例如上限(istrano)),你没事。

如果您以某种方式启动了捆绑器/缓存,请尝试删除.bundle文件夹(在项目文件夹中)

通过删除缓存文件并重新运行bundle install来修复它。

rm -rf 。 在你的情况下:

 rm -rf /afs/varda.io/user/b/br/bruno/test6/cache 

rvm reinstall all为我工作。

在你这样做之前,我会尝试

 gem update --system gem pristine --all --no-extensions 

请注意, rvm reinstall all需要花费很多时间才能完成…

如果可行的话,我建议在~/.rvm安装你自己的rvm副本,这样你就不会被系统绑定了。 尝试使用混合系统+用户方法可能会导致更多的麻烦。

或者,如果您对替代解决方案rbenv开放rbenvrbenv是一个更精简,更清洁的ruby经理。

尝试告诉bundler它必须使用哪个文件夹,比如bundle install --path bundle install --path gems

请注意,我还没有对此进行测试,但似乎很有希望,请将结果发布给我们。