【问题标题】:How do I fix an error with Ruby Gems Installer on WSL?如何修复 WSL 上 Ruby Gems 安装程序的错误?
【发布时间】:2019-01-29 14:27:47
【问题描述】:

我尝试使用 RubyGems 安装一个包(请注意,我使用的是适用于 Linux 的 Windows 子系统)。我打算安装 Jekyll 包。

我输入了$ gem install jekyll。之后它出现了一个错误:

Building native extensions. This could take a while...
/usr/lib/ruby/2.5.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

您能解释一下错误以及任何可能的修复方法吗?

【问题讨论】:

  • 一般在最后一行之后有更多的输出:ERROR: Failed to build gem native extension.。之后还有什么提示吗?
  • current directory: /home/[user]/.ruby/gems/http_parser.rb-0.6.0/ext/ruby_http_parser /usr/bin/ruby2.5 -r ./siteconf20190129-18-14vc5x8.rb extconf.rb creating Makefile current directory: /home/[user]/.ruby/gems/http_parser.rb-0.6.0/ext/ruby_http_parser make "DESTDIR=" clean sh: 1: make: not found current directory: /home/[user]/.ruby/gems/http_parser.rb-0.6.0/ext/ruby_http_parser make "DESTDIR=" sh: 1: make: not found make failed, exit code 127

标签: ruby bash rubygems windows-subsystem-for-linux


【解决方案1】:

您需要安装所需的构建工具:

sudo apt-get update
sudo apt-get install build-essential

【讨论】:

  • 我试过了,但是当我安装包时,它显示一个错误:E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-29.31_amd64.deb 404 Not Found [IP: 91.189.88.152 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 当我再次尝试安装 Ruby gem 时,它显示 Failed to build the gem native extension 错误再次。
  • 如果你运行apt-get update 后跟上面的命令,错误会改变吗?
  • 感谢@SaraTibbetts 这对我来说就像一个魅力!
猜你喜欢
  • 1970-01-01
  • 2018-05-09
  • 2010-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-17
相关资源
最近更新 更多