How to ignore a Gemfile when building a site

Hi folx!

I’m attempting to deploy my Storybook documentation from a repository that contains a mix of JS and Ruby.

I’m using the following command in my package.json file to generate the documentation into its own folder:

"scripts": {
  "build-storybook": "build-storybook -c .storybook"
}

This works great locally, but unfortunately when Netlify attempts to build the probject, it fails when attempting to install all the Ruby dependencies from my Gemfile. I don’t need any of that to happen since I just want to run a Yarn/NPM script.

Is there a way to skip installing a project’s Gemfile?

hmm, maybe this is too simple, but what happens if you just don’t include it in the repo that you push?

@perry removing the Gemfile works, so we know that’s definitely the problem! I can’t remove that from source control permanently, though. Is there a way to tell Netlify’s robots to ignore a file?

The build command runs after bundle install so I wouldn’t be able to delete the Gemfile there.

Hi @maxime, you can’t currently ignore the GemFile. Have you considered removing the Gem’s as part of your build process? You can change your build command to something similar to:

gem uninstall --all && npm run build

Note that in the future we plan on adding the ability to skip installing dependencies, but that functionality isn’t available yet and I don’t have a timeline as to when it will be.

Hey @futuregerald, this unfortunately doesn’t work. See my previous message:

The build command runs after bundle install so I wouldn’t be able to delete the Gemfile there.

Good to know this is something Netlify will support this in the future! For the moment, I’ve moved my site into a different repository, but that’s not ideal.

1 Like