gbif / hp-swiss-bif

0 stars 0 forks source link

Errors when trying to run the site locally #1

Closed giannijacot closed 4 months ago

giannijacot commented 5 months ago

Hello,

I'm trying to run the site locally for testing it and better understanding its functioning but i'm running into errors when running bundle install and bundle exec Jekyll serve.

I followed the instructions on the Jekyll website and it seems to works correctly but when I'm running bundle install from the hp-swiss-bif directory on my computer I got the following error :

Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
The dependency tzinfo (~> 1.2) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32 java`.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32 java`.
The dependency wdm (~> 0.1.1) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Unable to find a spec satisfying tzinfo (~> 1.2) in the set. Perhaps the lockfile is corrupted?

I tried renaming the "Gemfile.lock" file to recreate a new one when running bundle install (see Gemfile.lock.txt file) and it seemed to work but when I run bundle exec Jekyll serve after that I got the following error :

C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/jekyll-liquify-0.0.3/lib/jekyll-liquify.rb:15:in `<top (required)>': uninitialized constant LiquidFilter (NameError)

Liquid::Template.register_filter(LiquidFilter)
                                 ^^^^^^^^^^^^

        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/runtime.rb:60:in `require'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/runtime.rb:55:in `each'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/runtime.rb:55:in `block in require'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/runtime.rb:44:in `each'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/runtime.rb:44:in `require'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler.rb:187:in `require'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/jekyll-4.1.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/jekyll-4.1.1/exe/jekyll:11:in `<top (required)>'
        from C:/Ruby32-x64/bin/jekyll:32:in `load'
        from C:/Ruby32-x64/bin/jekyll:32:in `<main>'

Do you know if I have missed something in the install procedure or what could cause the errors ? Any help is appreciated !

I downloaded the latest version of Ruby (with devkit) and I'm on Windows 10.

MortenHofft commented 5 months ago

I'm in no ways a Jekyll or ruby expert. Quite the opposite. It isn't unlikely that I've commited nonsense. That sais it works on my mac and the build server. Let me know if I need to change anything

Could docker work for you? https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/2

docker run --rm --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" --env JEKYLL_ENV=development -p 4000:4000 jekyll/jekyll:4.1.0 jekyll serve

giannijacot commented 4 months ago

Hello, I have realised that the changes made on the repository are only displayed on the test site (and that we have to create a release for displaying them on the actual site) so the need to run the site locally for testing is currently less of a priority.

Docker could work for us. I will make some tests with it and keep you informed.

MattBlissett commented 4 months ago

Our build system uses a Docker image built here: https://github.com/gbif/hosted-portals/tree/main/docker

giannijacot commented 4 months ago

Thanks for the link to the Docker image. I've managed to run the site locally by using the command given to run the image and adding port mapping and the "jekyll serve" instruction. Here is the command I used :

docker run -e JEKYLL_ENV=development -p 4000:4000 --volume="path_to_the_repository:/srv/jekyll" docker.gbif.org/fast-jekyll:4.1.0 bash -c "jekyll build; /chown -R \"$(id -u):$(id -g)\" _site; jekyll serve"

(I've runned the commande in Windows command line)