error failed to build gem native extension

I was trying to install sass. I did manage to install it via npm (1.14.1 compiled with dart2js 2.0.0), however I need to install it with Ruby (Ruby Sass 3.5.6.). Now, here is the error when I run «sudo gem install sass»

I have tried to update Ruby, delete sass installed via npm, update xcode dev-tools as some suggested. But nothing works. I have no idea what is the reason since I had sass before updating to new Mac OS Mojave from 0.

Here is the mkmf.log file:

1 Answer 1

Ok, so the solution was found. If you have this error. Do this:

Then I had to run this command to make rvm work:

if sudo grep -q secure_path /etc/sudoers; then sudo sh -c «echo export rvmsudo_secure_path=1 >> /etc/profile.d/rvm_secure_path.sh» && echo Environment variable installed; fi

  1. next with rvm I deleted ruby:

rvm remove ruby

  1. and lastly install ruby:

rvm install ruby

not sure if this step was required, but this is what I had in my console: Ruby was built without documentation, to build it run: rvm docs generate-ri

So I also ran this command. And after that I was finally able to sudo gem install sass.

I’m getting the below error while installing ‘ redcarpet ‘ gem. It got installed without issue on my friends machine though. (I want to install this to run yard ) Ruby version: 1.9.3

cmd output:

UPDATE: With the devkit installation instructions provided at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit When I test the installation with json gem it fails there too 🙁

I went through the link for troubleshoot in github Native gem extension Error and followed the instructions to solve, Yet the problem persists..

I added the two paths to Env var C:ruby_devkitbin;C:ruby_devkitmingwbin; This removes the line Temporarily enhancing PATH to include DevKit. from appearing on cmd

when I try «sudo gem install rubocop», I get.

I tried reinstalling RVM with «rvm reinstall —disable-binary 2.2.0» which took a while but didn’t fix it

next i tried $ «sudo apt-get install ruby-dev» which yields

I’ve also tried «gem update —system» to which I get.

Any suggestions will be greatly appreciated as I am a total noob and I’m stuck.

3 Answers 3

Do sudo gem install rake and then do sudo gem install rubocop again and it should work.

It doesn’t seem to matter that you have the right version of rake installed. For me rake —version reported 10.5.0 but I was still getting the same error message as you. Looking at the error message, it is looking for rake at a specific path, not just anywhere on my PATH : /usr/bin/ruby2.3: No such file or directory — /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/rake (LoadError) . which rake reports /usr/local/bin/rake , not /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/rake . And in fact, as the error message says, there is no file at /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/rake . This is probably to do with rake having been apt-get install ed rather than gem install ed. sudo gem install rake creates that file.

I was able to resolve this problem with

When I answered this in 2017, I was skeptical of @SeanHammond’s solution, because the rake gem already appeared to be installed. That turns out to have been through Debian’s rake package and their rubygems-integration system. Installing the rake gem again, per Mr Hammond, worked for me today, as it overrode Debian’s version, hence avoided the underlying bug. Well, first it said:

After I applied an upstream fix for the error reporting, that said:

. which led me to succeed with:

That’s enough for rubygems to find the updated binary:

@ShaunJackman’s solution worked for me too. That might well be the way that Debian should fix it, though I’d rather not leave files in a directory on my machine that Debian might later want to change.

A less painful work-around was setting rake=/usr/bin/rake in the environment from which I installed the gem I wanted:

. as now noted in my Debian bug report. Your sudo might need —preserve-env to pass through that setting.

(In an earlier version of this answer, I claimed that «the equivalent of sudo gem install rainbow solved it» but it turns out that my problem was not equivalent. My problem wasn’t with gem, rainbow and rubocop but actually with gem2.1, mediawiki-gateway (or its successor, mediawiki_api) and unf. The reason that installing the dependency manually first worked for my case was that gem2.1 has a bug whereby it prefers to install prerelease versions as dependencies. I suspect, from the code rather than the prose, that the bug is this one, When asked to install unf itself, it instead, and rightly, picks a release version, one that just happens to use rubygem’s ExtConfBuilder code path rather than its RakeBuilder one. That wouldn’t have helped the original poster with their rainbow problem, as they didn’t get a prerelease version. Sorry for the lengthy digression, but perhaps it will help someone else facing a similar problem.)

Источник: computermaker.info

Понравилась статья? Поделиться с друзьями:
Ок! Компьютер
Добавить комментарий