问题描述
我有类似的问题:无效的规范缓存文件但没有答案.
I have a similar problem to: Invalid spec cache filebut it does not have an answer.
我们的Rails应用程序最近从ruby 2.1.2升级到了2.1.5
Our rails app recently upgraded from ruby 2.1.2 to 2.1.5
当我将其下载到笔记本电脑上(台式机可以正常工作)时,需要安装rvm 2.1.5,然后为2.1.5创建一个新的gemset.
When I downloaded this onto my laptop (desktop working fine) it required be to rvm install 2.1.5, then create a new gemset for 2.1.5
我尝试运行捆绑软件,但未安装捆绑软件,因此我尝试了gem install bundler
,它返回了以下错误消息:
I tried to run bundle and bundler isn't installed so I tried gem install bundler
and it responded with the following error message:
ERROR: While executing gem ... (Gem::Exception)
Invalid spec cache file in /my_dir/.gem/specs/api.rubygems.org%443/latest_specs.4.8
在检查该目录时,我发现有一个specs.4.8
文件,但没有一个latest_specs.4.8
文件
On checking that directory, I find that there is a specs.4.8
file but not a latest_specs.4.8
file
我尝试过的事情:
- 我删除并重新创建了宝石集,同样的问题.
- 我跑了
gem update
- 我炸掉了
/my_dir/.gem/specs
并重新运行了gem update
- 我跑了
gem update --system
- 我重新安装了ruby 2.1.5,然后又做了一遍...
- I deleted and re-created the gemset, same problem.
- I ran
gem update
- I blew away
/my_dir/.gem/specs
and rerangem update
- I ran
gem update --system
- I reinstalled ruby 2.1.5 and did it all again...
当我将ruby-version改回2.1.2并使用rvm use 2.1.2; bundle
时,它没有问题(但是捆绑程序已经存在于该gemset中).
When I changed the ruby-version back to 2.1.2 and used rvm use 2.1.2; bundle
it didn't have a problem (but then bundler already exists in that gemset).
宝石环境:
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-darwin10.0]
- INSTALLATION DIRECTORY: /my_dir/.rvm/gems/ruby-2.1.5
- RUBY EXECUTABLE: /my_dir/.rvm/rubies/ruby-2.1.5/bin/ruby
- EXECUTABLE DIRECTORY: /my_dir/.rvm/gems/ruby-2.1.5/bin
- SPEC CACHE DIRECTORY: /my_dor/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
- /my_dir/.rvm/gems/ruby-2.1.5
- /my_dir/.rvm/gems/ruby-2.1.5@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
推荐答案
尝试一下:
gem sources --clear-all
gem sources --update
如果这不起作用,请在此处查看我的较长答案:损坏的红宝石宝石系统
If that doesn't work, see my longer answer here: Corrupted ruby gem system
这篇关于.../latest-specs.rb中的无效规范缓存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!