Error installing jekyll: ERROR: Failed to build gem native extension
Asked Answered
D

4

12

I use github+jekyll to build blog, i try to install jekyll to local(windows 10), while it failed when i rungem install jekyll and the stack trace is

C:\Developments\FrontEnd\rubygems-2.7.7>gem install jekyll
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

    current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
C:/Developments/FrontEnd/Ruby25-x64/bin/ruby.exe -r ./siteconf20180806-33956-l8y76h.rb extconf.rb
creating Makefile

current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.

current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.

make failed, exit code 1

what i do is: 1. install ruby, path variable was set, version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]. 2. install rubygems, version: 2.7.7. 3. install MSYS2. 4. install jekyll, gem install jekyll, then the above error occurs and i'm not sure the reason.

i have tried to install devkit and it not works, i think my ruby version is 2.5+, so don't need devkit and i have uninstalled it.

Anyone could help me?

Decomposed answered 6/8, 2018 at 2:8 Comment(7)
1. You still need devkit for Ruby 2.5+ to install C extension gems (doubtful you have set up MSYS and MingW independently of Ruby based on this question. Unsure why you would feel it is not needed for 2.5+ 2. RubyGems is already packaged with Ruby, you don't need to install it.Porky
@Porky helpful, I re-install Ruby with DevKit, now it works, jekyll could installed.Decomposed
They did make separate downloads for the Windows installer that do not include DevKit, but is practically a necessity. It is quite necessary to be able to use a large percentage extremely popular gems.Porky
@Porky could you add this answer not in comments, then i can accept your answer.Decomposed
No problem, I made a post for ya :)Porky
for those here from search engines looking for the solution on Linux machines: you need to install ruby dev using: sudo apt install ruby-dev firstLifework
installing a static site generator should take seconds. installing jekyll on windows takes half an hour or longer, and requires workarounds. sad that such a nonsensical superfat thing became github's choice and remains it.Said
P
10

Although they made the Ruby+DevKit an "optional" download for the RubyInstaller on Windows, if you plan to install gems, it is practically a necessity. A large percentage of the most popular gems are C extension that will need built on your machine when being installed.

The DevKit is a handy toolchain that supplies everything you need for this to be done, automatically without you needed to do anything more than type gem install XXXXX. Without it, you either cannot use C extension gems, or must have already installed MSYS and MingW, have them configured properly, which is all not a user-friendly experience, even for those who familiar with the process.

So even if DevKit is optional, it is still required to make the most of Ruby on Windows.

Porky answered 6/8, 2018 at 7:32 Comment(0)
C
4

Solution re-install ruby with rubyinstaller-devkit-2.5.5-1-x64

and issue

gem install bundler

gem install jekyll
Contrast answered 5/6, 2019 at 9:13 Comment(0)
A
3

I got the same error message. It turned out that the culprit was the ffi gem. I got it to work using this solution.

Aerosol answered 20/12, 2020 at 15:25 Comment(0)
G
0

I had the same issue. I was able to resolve it (in Windows 11 x64) via:

winget install -e --id RubyInstallerTeam.RubyWithDevKit

(I.e., reinstall Ruby with the DevKit)

Geotaxis answered 10/5, 2022 at 20:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.