无法构建gem本机扩展。 +耙失败,退出代码1

时间:2018-12-04 15:02:09

标签: ruby-on-rails install bundler gemfile

尝试在从远程仓库中克隆的rails应用程序中安装gems时遇到多个错误,这是一个错误的屏幕截图,知道我仍然对RoR不熟悉,知道我尝试了很多答案但没有任何作用

elta3lab@elta3lab-Inspiron-N5110:~/raye7-api$ bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32`.
Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...........................................................................
Using rake 12.3.1
Fetching concurrent-ruby 1.1.3


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Installing concurrent-ruby 1.1.3
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Fetching activesupport 4.2.11
Installing activesupport 4.2.11
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Fetching nokogiri 1.8.5
Installing nokogiri 1.8.5 with native extensions
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.9
Fetching crass 1.0.4
Installing crass 1.0.4
Fetching loofah 2.2.3
Installing loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Fetching actionview 4.2.11
Installing actionview 4.2.11
Fetching rack 1.6.11
Installing rack 1.6.11
Using rack-test 0.6.3
Fetching actionpack 4.2.11
Installing actionpack 4.2.11
Using globalid 0.4.1
Fetching activejob 4.2.11
Installing activejob 4.2.11
Fetching mini_mime 1.0.1
Installing mini_mime 1.0.1
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 4.2.11
Installing actionmailer 4.2.11
Fetching activemodel 4.2.11
Installing activemodel 4.2.11
Using arel 6.0.4
Fetching activerecord 4.2.11
Installing activerecord 4.2.11
Using activerecord-import 0.20.2
Fetching public_suffix 3.0.3
Installing public_suffix 3.0.3
Using addressable 2.5.2
Using bundler 1.16.1
Using thor 0.19.4
Fetching railties 4.2.11
Installing railties 4.2.11
Using hike 1.2.3
Using multi_json 1.13.1
Using tilt 1.4.1
Fetching sprockets 2.12.5
Installing sprockets 2.12.5
Using sprockets-rails 2.3.3
Fetching rails 4.2.11
Installing rails 4.2.11
Fetching apipie-rails 0.5.14
Installing apipie-rails 0.5.14
Using ast 2.4.0
Using execjs 2.7.0
Fetching autoprefixer-rails 9.4.2
Installing autoprefixer-rails 9.4.2
Fetching aws-sigv4 1.0.3
Installing aws-sigv4 1.0.3
Fetching jmespath 1.4.0
Installing jmespath 1.4.0
Fetching aws-sdk-core 2.11.184
Installing aws-sdk-core 2.11.184
Fetching aws-sdk-resources 2.11.184
Installing aws-sdk-resources 2.11.184
Fetching aws-sdk 2.11.184
Installing aws-sdk 2.11.184
Fetching bcrypt 3.1.12
Installing bcrypt 3.1.12 with native extensions
Using bootstrap-datepicker-rails 1.7.1.1
Using sass 3.2.19
Using bootstrap-sass 3.3.5
Using momentjs-rails 2.17.1
Using bootstrap3-datetimepicker-rails 3.1.3
Using bugsnag 6.9.0
Using uniform_notifier 1.10.0
Using bullet 5.6.1
Using byebug 9.1.0
Using cancancan 1.17.0
Using xpath 2.1.0
Using capybara 2.15.4
Using capybara-email 2.5.0
Fetching mime-types-data 3.2018.0812
Installing mime-types-data 3.2018.0812
Fetching mime-types 3.2.2
Installing mime-types 3.2.2
Fetching carrierwave 1.2.3
Installing carrierwave 1.2.3
Using carrierwave-aws 1.2.0
Using carrierwave-base64 2.6.1
Using chartkick 2.2.5
Using coffee-script-source 1.12.2
Using coffee-script 2.4.1
Using coffee-rails 4.0.1
Using sass-rails 4.0.5
Using chosen-rails 1.5.2
Using chronic 0.10.2
Using coderay 1.1.2
Fetching connection_pool 2.2.2
Installing connection_pool 2.2.2
Using cookiejar 0.3.3
Using daemons 1.2.6
Using data_migrate 3.2.2
Using database_cleaner 1.6.2
Fetching delayed_job 4.1.5
Installing delayed_job 4.1.5
Fetching delayed_job_active_record 4.1.3
Installing delayed_job_active_record 4.1.3
Using orm_adapter 0.5.0
Using responders 2.4.0
Using warden 1.2.7
Using devise 4.3.0
Using devise_token_auth 0.1.43
Using diff-lcs 1.3
Using docile 1.1.5
Using unf_ext 0.0.7.5
Using unf 0.1.4
Fetching domain_name 0.5.20180417
Installing domain_name 0.5.20180417
Using eventmachine 1.0.9.1
Using em-socksify 0.3.2
Using http_parser.rb 0.6.0
Using em-http-request 1.1.5
Using email_check 1.0.1
Using erubi 1.7.1
Fetching factory_bot 4.11.1
Installing factory_bot 4.11.1
Fetching factory_bot_rails 4.11.1
Installing factory_bot_rails 4.11.1
Using faker 1.8.7
Using multipart-post 2.0.0
Fetching faraday 0.15.4
Installing faraday 0.15.4
Using faraday_middleware 0.12.2
Using websocket-extensions 0.1.3
Using websocket-driver 0.7.0
Using faye-websocket 0.10.7
Using faye 1.1.2
Using faye-rails 2.0.3
Using multi_xml 0.6.0
Using httparty 0.15.7
Fetching fcm 0.0.6
Installing fcm 0.0.6
Fetching ffi 1.9.25
Installing ffi 1.9.25 with native extensions
Using file_validators 2.1.0
Fetching font-awesome-rails 4.7.0.4
Installing font-awesome-rails 4.7.0.4
Using font-awesome-sass 4.7.0
Using foreman 0.84.0
Using formatador 0.2.5
Using formtastic 3.1.5
Fetching geocoder 1.4.9
Installing geocoder 1.4.9
Fetching geokit 1.13.1
Installing geokit 1.13.1
Fetching geokit-rails 2.3.1
Installing geokit-rails 2.3.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using ruby_dep 1.5.0
Using listen 3.1.5
Fetching lumberjack 1.0.13
Installing lumberjack 1.0.13
Using nenv 0.3.0
Using shellany 0.0.1
Using notiffany 0.1.1
Fetching method_source 0.9.2
Installing method_source 0.9.2
Using pry 0.11.3
Fetching guard 2.15.0
Installing guard 2.15.0
Using guard-compat 1.2.1
Using rspec-support 3.7.1
Using rspec-core 3.7.1
Using rspec-expectations 3.7.0
Using rspec-mocks 3.7.0
Using rspec 3.7.0
Using guard-rspec 4.7.3
Using haml 4.0.7
Using hash-deep-merge 0.1.1
Using hashie 3.5.7
Fetching highline 2.0.0
Installing highline 2.0.0
Using http-cookie 1.0.3
Using json 1.8.6
Fetching hypertrack 0.1.6
Installing hypertrack 0.1.6
Fetching parser 2.5.3.0
Installing parser 2.5.3.0
Fetching rails-i18n 4.0.9
Installing rails-i18n 4.0.9
Fetching rainbow 2.2.2
Installing rainbow 2.2.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /tmp/bundler20181204-31799-okhy3brainbow-2.2.2/gems/rainbow-2.2.2/ext
/usr/bin/ruby2.5 mkrf_conf.rb

current directory: /tmp/bundler20181204-31799-okhy3brainbow-2.2.2/gems/rainbow-2.2.2/ext
/usr/bin/ruby2.5 -rrubygems /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake
RUBYARCHDIR=/tmp/bundler20181204-31799-okhy3brainbow-2.2.2/extensions/x86_64-linux/2.5.0/rainbow-2.2.2
RUBYLIBDIR=/tmp/bundler20181204-31799-okhy3brainbow-2.2.2/extensions/x86_64-linux/2.5.0/rainbow-2.2.2
/usr/bin/ruby2.5: No such file or directory -- /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake (LoadError)

rake failed, exit code 1

Gem files will remain installed in /tmp/bundler20181204-31799-okhy3brainbow-2.2.2/gems/rainbow-2.2.2 for inspection.
Results logged to /tmp/bundler20181204-31799-okhy3brainbow-2.2.2/extensions/x86_64-linux/2.5.0/rainbow-2.2.2/gem_make.out

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

In Gemfile:
  i18n-tasks was resolved to 0.9.28, which depends on
    rainbowMake sure that `gem install rainbow -v '2.2.2'` succeeds before bundling.

In Gemfile:
  i18n-tasks was resolved to 0.9.28, which depends on
    rainbow

enter image description here

当尝试安装Rainbow时,无论是否安装sudo,我都会收到此错误

Building native extensions. This could take a while...
ERROR:  Error installing rainbow:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/rainbow-2.2.2/ext
/usr/bin/ruby2.5 mkrf_conf.rb

current directory: /var/lib/gems/2.5.0/gems/rainbow-2.2.2/ext
/usr/bin/ruby2.5 -rrubygems /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake RUBYARCHDIR=/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/rainbow-2.2.2 RUBYLIBDIR=/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/rainbow-2.2.2
/usr/bin/ruby2.5: No such file or directory -- /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake (LoadError)

rake failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.5.0/gems/rainbow-2.2.2 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/rainbow-2.2.2/gem_make.out

enter image description here

1 个答案:

答案 0 :(得分:1)

使用

解决
$user_field[]