【问题标题】:Failed to build gem native extension nio4r in Vagrant SSH windows 7 32-bit无法在 Vagrant SSH windows 7 32 位中构建 gem 本机扩展 nio4r
【发布时间】:2018-02-20 08:57:36
【问题描述】:

我在 Windows 7 32 位主机中使用 Vagrant 和框 ubuntu/trusty32 设置 Rails 环境。我坚持使用bundle install --path=./vendor/bundle。我收到以下错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /vagrant/vendor/bundle/ruby/2.4.0/gems/nio4r-2.1.0/ext/nio4r
/home/vagrant/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20170911-24730-8nkvsn.rb extconf.rb
checking for unistd.h... yes
checking for sys/select.h... yes
checking for poll.h... yes
checking for sys/epoll.h... yes
checking for sys/event.h... no
checking for port.h... no
checking for sys/resource.h... yes
creating Makefile

Text file busy @ unlink_internal - ./siteconf20170911-24730-8nkvsn.rb

Gem files will remain installed in /vagrant/vendor/bundle/ruby/2.4.0/gems/nio4r-2.1.0 for inspection.
Results logged to /vagrant/vendor/bundle/ruby/2.4.0/extensions/x86-linux/2.4.0-static/nio4r-2.1.0/gem_make.out

An error occurred while installing nio4r (2.1.0), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.1.0'` succeeds before bundling.

In Gemfile:
  rails_admin was resolved to 1.2.0, which depends on
    rails was resolved to 5.0.6, which depends on
      actioncable was resolved to 5.0.6, which depends on
        nio4r

问题似乎是 gem nio4r 的问题。我试过这些:

  • gem install bundler
  • bundle update
  • gem uninstall nio4r
  • gem install nio4r(这成功安装了gem)
  • rm Gemfile.lock
  • bundle install

以上都不起作用。我也试过这个:

sudo apt-get install ruby2.2-dev

但它找不到包。

E: Unable to locate package ruby2.2-dev
E: Couldn't find any package by regex 'ruby2.2-dev'

【问题讨论】:

    标签: ruby-on-rails ruby ubuntu vagrant vagrant-windows


    【解决方案1】:

    该错误主要针对消息Text file busy @ unlink_internal - ./siteconf20170911-24730-8nkvsn.rb。 I found a solution and I followed the steps described in the article.

    通过将包路径更改为 VM 本地的目录(不在共享文件夹上),错误消失了。

    1. 创建一个新目录

      mkdir ~/.bundles
      
    2. 将此添加到/vagrant/.bundle/config

      BUNDLE_PATH: "/home/vagrant/.bundles/PROJECT_NAME_HERE"
      BUNDLE_DISABLE_SHARED_GEMS: "1"
      
    3. 运行bundle install

    【讨论】:

      猜你喜欢
      • 2017-05-23
      • 2016-11-23
      • 2015-12-22
      • 2021-06-25
      • 2023-03-17
      • 2019-06-20
      • 1970-01-01
      • 1970-01-01
      • 2018-04-26
      相关资源
      最近更新 更多