pattex / jekyll-tagging

Jekyll plugin to automatically generate a tag cloud and tag pages.
385 stars 76 forks source link

Cannot require. #7

Closed matthiasbeyer closed 11 years ago

matthiasbeyer commented 11 years ago

I followed your instructions and did

gem install jekyll-tagging

and insert a file extr.rb in ./plugins and insert

require 'jekyll/tagging'

but it results in the following error:

/home/matthias/blog/plugins/ext.rb:1:in `require': cannot load such file -- jekyll-tagging (LoadError)
        from /home/matthias/blog/plugins/ext.rb:1:in `<top (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:76:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:76:in `block in setup'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:75:in `each'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:75:in `setup'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:30:in `initialize'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:224:in `new'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:224:in `<top (required)>'
        from /usr/bin/jekyll:19:in `load'
        from /usr/bin/jekyll:19:in `<main>'

kind regards.

blackwinter commented 11 years ago

are you sure you have require 'jekyll/tagging' and not require 'jekyll-tagging' in your plugin file? because that's what the error message says.

matthiasbeyer commented 11 years ago

Of course, that was my fault. I tried it with both 'jekyll/tagging' and 'jekyll-tagging' and both failed, I copied the wrong one! That error occurs also if I write 'jekyll/tagging'!

blackwinter commented 11 years ago

well, then where exactly did you install jekyll-tagging? what does gem env say?

matthiasbeyer commented 11 years ago
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.8
  - RUBY VERSION: 1.9.3 (2012-11-10 patchlevel 327) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.9.1
     - /home/matthias/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--user-install"
  - REMOTE SOURCES:
     - http://rubygems.org/

I did exactly what your readme says, I think (Step 1 and 2 of course, If the plugin doesn't load as expected, there's no need to insert something in the _config.yml file).

blackwinter commented 11 years ago

i'm sorry it doesn't work for you, but this is certainly not a jekyll-tagging issue. there must be something off with your environment. does gem which jekyll/tagging find the gem? do other gems work when you try to load them in your plugins/ext.rb file?

matthiasbeyer commented 11 years ago
~$ gem which jekyll/tagging
/home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb

It seems the gem which jekyll/tagging finds the gem. Other gems were found. Maybe I simply put your code into the plugins-directory and try it this way.

blackwinter commented 11 years ago

were those other gems also installed below your home directory? does it work when you install jekyll-tagging in the system gem directory (--no-user-install)? you aren't using bundler or rvm gemsets in your project, are you?

matthiasbeyer commented 11 years ago

Of course, this is curious.

I added gem 'jekyll-tagging', '0.4.0' in the Gemfile and it works. I get an other error now, but for this I will submit another Issue.

Thanks for your help, I will close this Issue now.

ozgrozer commented 7 years ago

I did everything exactly. But I have same problem now.

$ gem which jekyll/tagging

/Users/mac/.rvm/gems/ruby-2.4.2/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb
$ jekyll build

Configuration file: /Applications/XAMPP/xamppfiles/htdocs/dasper/_config.yml
  Dependency Error: Yikes! It looks like you don't have jekyll-tagging or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-tagging' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.5.2 | Error:  jekyll-tagging
$ gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.13
  - RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x86_64-darwin17]
  - INSTALLATION DIRECTORY: /Users/mac/.rvm/gems/ruby-2.4.2
  - USER INSTALLATION DIRECTORY: /Users/mac/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /Users/mac/.rvm/rubies/ruby-2.4.2/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/mac/.rvm/gems/ruby-2.4.2/bin
  - SPEC CACHE DIRECTORY: /Users/mac/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/mac/.rvm/rubies/ruby-2.4.2/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-17
  - GEM PATHS:
     - /Users/mac/.rvm/gems/ruby-2.4.2
     - /Users/mac/.rvm/gems/ruby-2.4.2@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/mac/.rvm/gems/ruby-2.4.2/bin
     - /Users/mac/.rvm/gems/ruby-2.4.2@global/bin
     - /Users/mac/.rvm/rubies/ruby-2.4.2/bin
     - /Users/mac/.rvm/bin
     - /Library/Frameworks/Python.framework/Versions/3.5/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin