缺少nokogiri gemspec时出现Rails控制台错误,但nokogiri没有gemspec

时间:2019-01-30 20:59:46

标签: ruby-on-rails ruby nokogiri bundler

我试图通过RVM重新安装Ruby 2.3.6,以修复一些错误,在该错误中,我必须明确指定OpenSSL路径才能重新安装它。安装捆绑程序并在项目目录中运行bundle install后,我尝试运行rails cbundle exec rails c,只是得到此错误:

/Users/abhaskar/.rvm/gems/ruby-2.3.6@px-core/gems/bundler-1.16.1/lib/bundler/stub_specification.rb:97:in `_remote_specification': The gemspec for nokogiri-1.10.1 at /Users/abhaskar/.rvm/gems/ruby-2.3.6@px-core/specifications/nokogiri-1.10.1.gemspec was missing or broken. Try running `gem pristine nokogiri -v 1.10.1` to fix the cached spec. (Bundler::GemspecError)

但是,Nokogiri没有gemspec,并且运行建议的gem pristine命令并没有任何改变。我检查了Nokogiri是否列在我的Gemfile中。我的团队成员都没有面临相同的问题。如何诊断和解决此问题?

更新:bundle exec gem pristine nokogiri -v 1.10.1错误:

ERROR:  While executing gem ... (Gem::Ext::BuildError)
ERROR: Failed to build gem native extension.

current directory: /Users/abhaskar/.rvm/gems/ruby-2.3.6/gems/nokogiri-1.10.1/ext/nokogiri
/Users/abhaskar/.rvm/rubies/ruby-2.3.6/bin/ruby -r ./siteconf20190130-46592-q2jdnm.rb extconf.rb
/Users/abhaskar/.rvm/rubies/ruby-2.3.6/lib/ruby/site_ruby/2.3.0/bundler/spec_set.rb:91:in `block in materialize': Could not find nokogiri-1.10.1 in any of the sources (Bundler::GemNotFound)

1 个答案:

答案 0 :(得分:0)

以下是我的强烈建议:保全rvm并移至docker。您每次都会得到一个干净的版本。不用担心在不同项目之间混合系统库。等

了解docker会有一些开销,但是一旦您知道了,您就可以自由运行任何版本的postgres / mysql / rails / ruby​​ / whatever,并随意混合和匹配。