When deploying, I can see Netlify detects my Gemfile and installs the gems in the “Initializing” step. But the “Building” step fails with the following error:
bin/superstars.rb
12:30:10 AM: /opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require": cannot load such file -- jekyll/utils (LoadError)
from /opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require"
from bin/superstars.rb:4:in `<main>"
I have the jekyll gem declared in my Gemfile. I can also see it in my Gemfile.lock file, and also in the log output in Netlify. So why can my Ruby script not find the file when it is being invoked?
Deployments are blocked right now. Why does Netlify not find a file from a dependency that’s installed from the previous step? How is one meant to use Ruby gems as part of their build process if they disappear after a bundle install? Where are gems installed?
I have also noticed this in the output log of failed builds:
/opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require": cannot load such file -- jekyll (LoadError)
from /opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require"
from bin/superstars.rb:4:in `<main>"
The path looks a bit funky. It references ruby-2.7.2… and then …/ruby/2.7.0…?
@hrishikesh Nope, don’t need to do anything specific. All I did was create the site in Netlify, set the source repository, and add the following as the build command:
If I leave the build command as bundle exec jekyll build then it builds the Jekyll site just fine (I fixed that CSS error). But as soon as I update the command to also run bin/superstars.rb before, the build fails.
Again, the build command I’ve defined is:
bin/superstars.rb && bundle exec jekyll build
The error I get:
/opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require": cannot load such file -- jekyll (LoadError)
from /opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require"
from bin/superstars.rb:4:in `<main>"