Cannot Build the site on the preview server

Hi, I am a beginner on jekyll. I am following the documentation advice to Build the site on the preview server.
Here is what a did :

  • install the last version of ruby
    $ruby -v → ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
    $ gem --version → 2.6.14
  • Install Jekyll
    $gem install jekyll bundler → Version of jekyll : jekyll-3.6.2

When I try to build the site on the preview server (bundle exec jekyll serve) there is the following error :

jekyll 3.6.2 | Error: (/Users/admin/Documents/Perso/Site-Internet/Jekyll/inger/_config.yml): did not find expected key while parsing a block mapping at line 16 column 1

the line 16 is the first line uncommented that shoul be processed. It is this one

title: Inger Hair at Home at Aix en Provence (line 16)

I don’t see what can be wrong. Thank you in advance for your answers

If I had to guess it’s the parenthesis. Put it in quotes instead so it is treated as a string.

title: "Inger Hair at Home at Aix en Provence (line 16)"

Hi mmistakes and thank you for your answer. there isn’t any parenthesis. It was just an information of the line number for this post. And even when I put everything in quotes, I have the same error

Can you share your entire _config.yml file or link to a public repo? YAML can be very unforgiving and there is likely an indent or missing colon or something similar around line 16.

Hi mmistakes, and thank you for your answer. When I comment line 16 the error is at line 17. Here is the _config.yml file

Hi mmistakes, I found the solution : there were extra spaces at the exclude line. Now I am facing another issue which is the following

When I try to run

bundle exec jekyll serve

I have an error message which is the following

Dependency Error: Yikes! It looks like you don’t have /Users/admin/Documents/Perso/Site-Internet/Jekyll/inger/_plugins/amp_filter.rb
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 – nokogiri’ If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!

(I have the plugin amp_filter.rb and at the beginning of amp_filter.rb file, I have the following code

require 'nokogiri’
require ‘fastimage’

)

as it says

‘cannot load such file – nokogiri’

So I installed nokogiri

MBP-de-Admin:Jekyll admin$ gem install nokogiri
Building native extensions. This could take a while…
/Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /Users/admin in PATH, mode 040777
Successfully installed nokogiri-1.8.1
Parsing documentation for nokogiri-1.8.1
Installing ri documentation for nokogiri-1.8.1
Done installing documentation for nokogiri after 13 seconds
1 gem installed

And I have still the same error. Thank you in advance for your answers

Have you reached out to the Jekyll AMP developer? This is a different issue from the bad YAML in your config file.

try googling just that - this may help though it is about rails not jekyll and is a couple years old:

Instead of adding the plugin .rb files to your _plugins folder try removing them. Then install the gem version of the plugin by adding gem “amp-jekyll” to your Gemfile.

Run bundle update then try to build your site with bundle exec jekyll build.

Hi mmistakes and rdyar , thank you for your answer. I googled it and I followed the instruction I read. I did

gem install nokogiri

and checked that it was added (gem list)

and when I run

bundle exec jekyll serve

I have the same error

Configuration file: /Users/admin/Documents/Perso/Site-Internet/Jekyll/inger/_config.yml
Dependency Error: Yikes! It looks like you don’t have /Users/admin/Documents/Perso/Site-Internet/Jekyll/inger/_plugins/amp_filter.rb 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 – nokogiri’ If you run into trouble, you can find helpful resources at Redirecting…!
jekyll 3.6.2 | Error: /Users/admin/Documents/Perso/Site-Internet/Jekyll/inger/_plugins/amp_filter.rb

Considering adding gem “amp-jekyll” (and other gems) in Gemfile ,that was what I did at the beginning but none of the gem in Gemfile were running. I had the error

MBP-de-Admin:inger admin$ bundle exec jekyll serve
Could not find gem ‘amp-jekyll (= 1.0.2)’ in any of the gem sources listed in your Gemfile.

(and also the same error for the other gem)

So I chose to add the rb files in _plugins folder

Assuming for the time being that I chose to add rb files in _plugins folder, can you give me a way to solve my issue ? Thanks in advance

That’s probably because you did not run bundle install after…
So, the solution involves the following:

  • Remove _plugins/ directory
  • Add amp-jekyll to your Gemfile
    source "https://rubygems.org"
    
    gem "jekyll", "~> 3.6"
    gem "minima", "~> 2.0"
    
    group :jekyll_plugins do
      gem "amp-jekyll"
    end
    
  • Ensure the current directory in your terminal is the Jekyll project directory
  • Run bundle install
  • Start jekyll preview server
    bundle exec jekyll serve
    

Hi ashmaroll. Thank you very much for your answer. I did what you said and it works.
The only gem that I didn’t suceed in loading was “jekyll-ga” (https://github.com/developmentseed/jekyll-ga).

Do you think that putting

  gem "chronic"  # with jekyll-ga  # installed
  gem "google-api-client"  # with jekyll-ga  # installed

will be enough to use “jekyll-ga” ?

Another question. I found this ressource page : https://rubygems.org/gems?letter=J&page=42
Do you think there are all exhaustive gems that I can use in Gemfile ?

Finally, how can I grant you “a good answer” ?:slightly_smiling_face:

Hi again,

I don’t see also how to add “jekyll-ideal-image-slider”
(https://github.com/jekylltools/jekyll-ideal-image-slider)

Doesn’t look like this plugin has been “gemified”. Meaning you don’t install it with Bundler but rather copy over its _plugins folder over into the root of your project.

Hi mmistakes and thank you for your answer. And what about “jekyll-ga” ?

jekyll-ga has not been updated for over 4 years now… and from the source-code, it doesn’t look like it will work with Jekyll 3.x series… (Jekyll::Post) had been removed prior to shipping Jekyll 3.0.0