- Published on
Fixing the Rails Error Could not find nokogiri-1.10.8 in any of the sources
- Authors
- Name
- Yair Mark
- @yairmark
I have been playing around with Rails recently. When trying to generate a new controller using: rails generate controller Welcome index
I ran into the following error:
Traceback (most recent call last):
25: from /Users/yourUser/.gem/gems/spring-2.1.0/bin/spring:49:in `<main>'
24: from /Users/yourUser/.gem/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
23: from /Users/yourUser/.gem/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
22: from /Users/yourUser/.gem/gems/spring-2.1.0/lib/spring/client/server.rb:9:in `call'
21: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
20: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
19: from /Users/yourUser/.gem/gems/spring-2.1.0/lib/spring/server.rb:9:in `<top (required)>'
18: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
17: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
16: from /Users/yourUser/.gem/gems/spring-2.1.0/lib/spring/commands.rb:4:in `<top (required)>'
15: from /Users/yourUser/.gem/gems/spring-2.1.0/lib/spring/commands.rb:33:in `<module:Spring>'
14: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
13: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
12: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
11: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
10: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
9: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
8: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler.rb:149:in `setup'
7: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/runtime.rb:20:in `setup'
6: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/runtime.rb:101:in `block in definition_method'
5: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/definition.rb:226:in `requested_specs'
4: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/definition.rb:237:in `specs_for'
3: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/definition.rb:170:in `specs'
2: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `materialize'
1: from /Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `map!'
/Users/yourUser/.rbenv/versions/2.7.0/lib/ruby/2.7.0/bundler/spec_set.rb:86:in `block in materialize': Could not find nokogiri-1.10.8 in any of the sources (Bundler::GemNotFound)
Specifically, the actual error is:
'block in materialize': Could not find nokogiri-1.10.8 in any of the sources (Bundler::GemNotFound)
All the various suggestions online did not work. Except for this one. In my case, the issue seems to have been caused by there being more than one instance of nokogiri. When I ran gem uninstall nokogiri
I got the following:
Select gem to uninstall:
1. nokogiri-1.10.8
2. nokogiri-1.10.9
3. All versions
>
I removed all versions, then reinstalled the gem (gem install nokogiri
) and I no longer had the error :D