Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Failures: capybara -- `require': cannot load such file -- nokogiri (LoadError) #1919

Closed
huangsam opened this issue Jan 31, 2014 · 26 comments
Labels

Comments

@huangsam
Copy link

image

I'm not sure how to resolve this one. I've been trying to update my Gemfile to use different versions of capybara and so far nothing has been working to resolve this issue for my Travis-CI builds. Any ideas?

@roidrage
Copy link
Contributor

Does the Gemfile also include nokogiri? Or is nokogiri installed as part of the bundle install?

@sarahhodne
Copy link
Contributor

Could you please link us to the build where you are seeing this?

It looks like nokogiri is not being installed, which is odd since it's a dependency of Capybara. I wonder if the bundle install output will give any clues.

@huangsam
Copy link
Author

Gemfile does not include it, but Gemfile.lock does include it
nokogiri

@huangsam
Copy link
Author

@roidrage
Copy link
Contributor

That's quite odd, the bundle install doesn't seem to install nokogiri?

@huangsam
Copy link
Author

Not from what I see on the build. Rather curious.

@huangsam
Copy link
Author

I've seen some related issues here and there. Not sure if that helps with your troubleshooting.

@huangsam huangsam reopened this Jan 31, 2014
@roidrage
Copy link
Contributor

Could you add nokogiri directly to your Gemfile and see if that helps?

@huangsam
Copy link
Author

I did what you suggested, and the build still failed.

@huangsam
Copy link
Author

I even did a before_install: gem install nokogiri. According to Travis CI, nokogiri installed but the build still fails.

@BanzaiMan
Copy link
Contributor

Very curious. I don't see nokogiri getting installed. Did I miss it?

@huangsam
Copy link
Author

image

See it now?

@BanzaiMan
Copy link
Contributor

https://travis-ci.org/huangsam/ciscochef/builds/17989501#L100

Perhaps dependency resolution is failing somehow.

@huangsam
Copy link
Author

Yeah. That's exactly why I did the before_install, as a workaround. Clearly, injecting nokogiri into the Gemfile and before_install approach did not work.

@BanzaiMan
Copy link
Contributor

Truths experiment: create a small project locally with just nokogiri in Gemfile and see if installs nokogiri and its dependencies. If it works, try building it on Travis. We'll understand where the problem is.

@BanzaiMan
Copy link
Contributor

BYW if bundler does not activate nokogiri, installing it beforehand doesn't do any good.

@BanzaiMan
Copy link
Contributor

Try this experiment...

@huangsam
Copy link
Author

Did what you wanted - super-trivial and it breaks. Just got the error.

@BanzaiMan
Copy link
Contributor

I see the problem now. You are bundling the Windows version of nokogiri in your Gemfile.lock (https://github.com/huangsam/travis-nokogiri/blob/master/Gemfile.lock#L5), so that bundle install on our Linux VM tries to rebundle, but it fails.

See http://stackoverflow.com/questions/3642085/make-bundler-use-different-gems-for-different-platforms for a possible workaround.

@huangsam
Copy link
Author

One thing I did one want to mention is that when I do the approach of hiding the Gemfile.lock using a .gitignore on my Windows machine, Travis-CI works. However, when pushing to Heroku I get this nasty request:

heroku-push

It's like StackOverflow is telling Windows users one thing, while Heroku is telling them another thing.

@BanzaiMan
Copy link
Contributor

Not owning a Windows machine, I don't know what the best practice is. However, you can try creating a second Gemfile, identical to ./Gemfile, and point to it with gemfile in ./travis.yml.

@huangsam
Copy link
Author

image

Bingo! Works on Heroku and Travis CI now. Thanks a bunch!

mushishi78 added a commit to jekyll-store/microservice that referenced this issue Apr 14, 2015
@hypolyte
Copy link

I'm using ruby 2.3.3 on my project and nokogiri 1.6.8.rc2.The build failed on Gitlab ci.The error message is: `require': cannot load such file -- nokogiri (LoadError).
could someone helps?Thanks!

@BanzaiMan
Copy link
Contributor

@hypolyte You'll need to ask Gitlab for support.

@hypolyte
Copy link

That's what I'm doing!

@BanzaiMan
Copy link
Contributor

@hypolyte Sorry, but this is GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants