Skip to content

Can't Build Site Locally: bundle install failed with "An error occurred while installing nokogiri (1.8.4)" #1150

Closed

Description

@xingyif

I try to build and view the site locally. When I run bundle install, I got

Errno::EACCES: Permission denied @ rb_sysopen -
/Users/USERNAME/DIR/DIR/DIR/docs.scala-lang/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/.autotest
An error occurred while installing nokogiri (1.8.4), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.4' --source 'https://rubygems.org/'` succeeds
before bundling.

When I installed nokogiri manually and successfully by running gem install nokogiri -v '1.8.4' --source 'https://rubygems.org/', and then run bundle install, same error appears.

I am using macOS Sierra version 10.12.3

yifans-MacBook-Pro:docs.scala-lang yifanxing$ bundle exec jekyll serve -I
Could not find gem 'jekyll-redirect-from' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
yifans-MacBook-Pro:docs.scala-lang yifanxing$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.1
Using public_suffix 3.0.3
Using addressable 2.5.2
Using bundler 1.16.5
Using colorator 1.1.0
Using colorize 0.8.1
Using eventmachine 1.2.7
Using http_parser.rb 0.6.0
Using em-websocket 0.5.1
Using ffi 1.9.25
Using ethon 0.11.0
Using forwardable-extended 2.6.0
Using mercenary 0.3.6
Using mini_portile2 2.3.0
Fetching nokogiri 1.8.4
Installing nokogiri 1.8.4 with native extensions
**Errno::EACCES: Permission denied @ rb_sysopen -
/Users/USERNAME/DIR/DIR/DIR/docs.scala-lang/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/.autotest
An error occurred while installing nokogiri (1.8.4), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.4' --source 'https://rubygems.org/'` succeeds
before bundling.**

In Gemfile:
  html-proofer was resolved to 3.9.2, which depends on
    nokogiri
yifans-MacBook-Pro:docs.scala-lang yifanxing$ **gem install nokogiri -v '1.8.4' --source** 'https://rubygems.org/'
Building native extensions. This could take a while...
/Users/yifanxing/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /Users/USERNAME/DIR/DIR in PATH, mode 040777
Successfully installed nokogiri-1.8.4
Parsing documentation for nokogiri-1.8.4
Done installing documentation for nokogiri after 7 seconds
1 gem installed
yifans-MacBook-Pro:docs.scala-lang yifanxing$ 

Activity

  1. changed the title [-]Can't Start Server: bundle install failed with "An error occurred while installing nokogiri (1.8.4)"[/-] [+]Can't Build Site Locally: bundle install failed with "An error occurred while installing nokogiri (1.8.4)"[/+] on Sep 21, 2018
  2. SethTisue commented on Sep 26, 2018

    @SethTisue
    Member

    I know I've hit this more than once before, googled it before, resolved it somehow, and then forgotten what I did. see e.g. sparklemotion/nokogiri#1504

    If anyone knows the solution, we should add it to the doc here. (And yes, I should have done it myself before... ah, well, I guess I didn't know yet whether it would turn into something of an FAQ.)

    Or maybe whatever nokogiri problem this is isn't the same one I hit, I just know that I remember nokogiri being trouble.

  3. kotobotov commented on Jan 9, 2019

    @kotobotov
    Contributor

    i had some problem with ruby ecosystem too, and just use docker, as i mention at docker support pull request.

  4. SethTisue commented on Feb 11, 2019

    @SethTisue
    Member

    I think I remember now that xcode-select --install used to fix this. @xingyif you might try that

    But also, I hit this today and xcode-select --install didn't fix it. I think what I am experiencing is a new problem on MacOS 10.14 (Yifan's report was on 10.12). The problem is: described here: https://silvae86.github.io/sysadmin/mac/osx/mojave/beta/libxml2/2018/07/05/fixing-missing-headers-for-homebrew-in-mac-osx-mojave/

    And the upshot is, this fixes it: sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

  5. SethTisue commented on Feb 11, 2019

    @SethTisue
    Member

    just use docker

    (I opened #1286 on my troubles with this option)

  6. SethTisue commented on Feb 15, 2019

    @SethTisue
    Member

    closing on the assumption that any trouble is fixable via some combination of:

    xcode-select --install
    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
    

    93510f5 adds a link to this ticket from the readme

  7. SethTisue commented on Feb 7, 2022

    @SethTisue
    Member

    sigh, on my M1 Mac on macOS 12.1 (Monterey) I'm getting:

    '/Users/tisue/docs.scala-lang/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.12.5-x86_64-darwin/lib/nokogiri/2.6/nokogiri.bundle' (mach-o file, but is an incompatible architecture (have
    'x86_64', need 'arm64e')), '/usr/lib/nokogiri.bundle' (no such file) -
    
  8. SethTisue commented on Feb 7, 2022

    @SethTisue
    Member
  9. SethTisue commented on Feb 7, 2022

    @SethTisue
    Member

    that worked

  10. byyue commented on Feb 25, 2022

    @byyue
    Contributor

    this seems promising: https://www.earthinversion.com/blogging/how-to-install-jekyll-on-appple-m1-macbook/

    In case it doesn't work, try:
    bundle update nokogiri

  11. SethTisue commented on Apr 27, 2023

    @SethTisue
    Member

    #2779 may also be helpful for Mac users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions