简体   繁体   English

无法在Vagrant SSH Windows 7 32位中构建gem本机扩展nio4r

[英]Failed to build gem native extension nio4r in Vagrant SSH windows 7 32-bit

I'm setting up Rails environment using Vagrant with the box ubuntu/trusty32 in Windows 7 32-bit host. 我正在Windows 7 32位主机中使用带有框ubuntu / trusty32的 Vagrant设置Rails环境。 I'm stuck with bundle install --path=./vendor/bundle . 我陷入bundle install --path=./vendor/bundle I got the following error: 我收到以下错误:

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

The problem seems to be the issue of the gem nio4r . 问题似乎是宝石nio4r的问题。 I have tried these: 我已经尝试过这些:

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

None of the above works. 以上都不是。 I also tried this: 我也试过这个:

sudo apt-get install ruby2.2-dev

But it couldn't find the package. 但是找不到包。

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

The error mainly addresses to the message Text file busy @ unlink_internal - ./siteconf20170911-24730-8nkvsn.rb . 该错误主要针对消息Text file busy @ unlink_internal - ./siteconf20170911-24730-8nkvsn.rb I found a solution and I followed the steps described in the article . 我找到了解决方案,然后按照本文中描述的步骤进行操作

By changing bundle path to a directory that's local to the VM (not on a shared folder) made the error gone away. 通过将捆绑包路径更改为VM本地目录(不在共享文件夹上),可以消除错误。

  1. Create a new directory 创建一个新目录

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM