'Failed to build gem native extension' on Windows 7 (The system cannot find the path specified)

前端 未结 7 1545
一生所求
一生所求 2020-12-15 18:47

The problem in short

I\'m on Windows and am getting the following error when running gem install json —platform=ruby:

The system canno         


        
相关标签:
7条回答
  • 2020-12-15 18:57

    So this isn't the best answer in the world, but I seem to have stumbled on a solution. If I set the verbose flag, everything works fine:

    gem install json --platform=ruby --verbose
    

    There's a log here: http://gist.github.com/dannysmith/8055495

    That makes no sense - it'd be great if someone could explain why this seems to have fixed the error. Perhaps this is a bug in devkit?

    0 讨论(0)
  • 2020-12-15 19:07

    How I fixed it:

    1. Downloaded the latest ruby installer from https://rubyinstaller.org/downloads/
    2. Ran the installer, following the prompts to install dependencies.
    3. Restarted my computer.
    4. Added the ruby/bin directory to my PATH.
    0 讨论(0)
  • 2020-12-15 19:09

    I have gem json installed with versions 1.8.1 but I was not able to solve this issue for json 1.6.1 using

    gem install json --platform=ruby --verbose
    

    So, I tried from here https://github.com/oneclick/rubyinstaller/issues/184

    gem update --system 2.0.3
    

    And after that

    gem install json -v 1.6.1 --platform=ruby --verbose
    

    It solve issue specific to json 1.6.1 for Win 7(64 bit) machine

    0 讨论(0)
  • 2020-12-15 19:09

    Install the 32 bit version on Windows...

    ver
    windows 6.1.76011
    

    64 bit gave error message about makefile and headers. Tried all other suggestions including those on rubyinstaller about COMSPEC and registry, adding gcc to path, and others. Some gems would install but git_fame and json would not as needed to compile.

    Edit: It looks like git_fame uses mimer_plus. mimer_plus assumes gnu tools (unix tools). Looks like you need to install mingw first. That was not clearly indicated on the rubyinstaller page.

    0 讨论(0)
  • 2020-12-15 19:15

    I had the same problem. I used powershell to check my path

    ps> $s = $env:path

    ps> $s.split("{;}")

    sure enough my the ruby mingw was not in the path. I had the ruby\bin in the path but the mingw\bin was under a different folder. I went into my environment path and added it and my install worked.

    0 讨论(0)
  • 2020-12-15 19:16

    Make sure that the ruby version you installed (32 or 64 bit) matches the DevKit version. They both have to be 32 or 64, which was the issue I was having. May not be the exact issue here, but thought I'd throw that out there. Here's a post worth checking out:

    Rails on windows - install issue

    0 讨论(0)
提交回复
热议问题