您的Ruby版本是2.3.1,但您的Gemfile指定为2.1.2

时间:2016-08-16 16:25:54

标签: ruby-on-rails rubygems rvm gemfile

我使用rvm来管理我的Ubuntu 16.04本地计算机上的ruby版本。

我在一个新的分支上工作了一段时间,最后我没有合并。我开始时遇到Gemfile的一些问题,但我不记得它究竟是什么。

My Gemfile就是这样开始的:

source 'https://rubygems.org'
ruby "2.1.2"

当我尝试rails s时,我得到了:

Your Ruby version is 2.3.1, but your Gemfile specified 2.1.2

我尝试了rvm use 2.1.2并得到了:

Using /home/guy/.rvm/gems/ruby-2.1.2

但仍然收到这条消息。

第2步

我将Gemfile改为开头:

source 'https://rubygems.org'
ruby "2.3.1"

当我bundle install时,我得到:

Your Ruby version is 2.1.2, but your Gemfile specified 2.3.1

所以我做了rvm use 2.3.1然后bundle install得到了:

Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies.....
Using rake 11.1.2
Using CFPropertyList 2.3.1
Using i18n 0.7.0
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.43
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using mime-types 2.4.3
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using addressable 2.3.6
Using excon 0.45.3
Using formatador 0.2.5
Using net-ssh 2.9.2
Using mini_portile 0.5.2
Using ipaddress 0.8.0
Using inflecto 0.0.2
Using unf_ext 0.0.7.1
Using json 1.8.2
Using uuidtools 2.1.4
Using bundler 1.12.5
Using thor 0.19.1
Using hike 1.2.3
Using tilt 1.4.1
Using bcrypt 3.1.7
Using multi_xml 0.5.5
Using multipart-post 2.0.0
Using jwt 1.0.0
Using breadcrumbs_on_rails 2.3.0
Using buftok 0.2.0
Using uniform_notifier 1.9.0
Using cancan 1.6.10
Using coffee-script-source 1.7.0
Using execjs 2.0.2
Using commonjs 0.2.7
Using crass 0.2.1
Using dalli 2.7.4
Using orm_adapter 0.5.0
Using equalizer 0.0.9
Using hashie 2.1.2
Using htmlentities 4.3.2
Using http_parser.rb 0.6.0
Using httpclient 2.6.0.1
Using sass 3.2.18
Using kgio 2.9.3
Using libv8 3.16.14.3
Using naught 1.0.0
Using newrelic_rpm 3.9.5.251
Using oauth 0.4.7
Using pg 0.17.1
Using populator 1.0.0
Using signature 0.1.8
Using railroady 1.3.0
Using rails_serve_static_assets 0.0.2
Using rails_stdout_logging 0.0.3
Installing raindrops 0.12.0 with native extensions

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

    current directory: /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0/ext/raindrops
/home/guy/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160816-17319-1gslbxl.rb extconf.rb
checking for mmap() in sys/mman.h... yes
checking for munmap() in sys/mman.h... yes
checking for mremap() in sys/mman.h... yes
checking for getpagesize() in unistd.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_io_blocking_region()... yes
checking for GCC 4+ atomic builtins... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/guy/.rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/raindrops-0.12.0/mkmf.log

current directory: /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0/ext/raindrops
make "DESTDIR=" clean

current directory: /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0/ext/raindrops
make "DESTDIR="
compiling raindrops.c
compiling linux_inet_diag.c
In file included from linux_inet_diag.c:17:0:
/home/guy/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp]
 #warning rubysig.h is obsolete
  ^
linux_inet_diag.c: In function ‘rb_thread_blocking_region’:
linux_inet_diag.c:28:2: error: ‘TRAP_BEG’ undeclared (first use in this function)
  TRAP_BEG;
  ^
linux_inet_diag.c:28:2: note: each undeclared identifier is reported only once for each function it appears in
linux_inet_diag.c:30:2: error: ‘TRAP_END’ undeclared (first use in this function)
  TRAP_END;
  ^
linux_inet_diag.c: At top level:
linux_inet_diag.c:22:1: warning: ‘rb_thread_blocking_region’ defined but not used [-Wunused-function]
 rb_thread_blocking_region(
 ^
Makefile:238: recipe for target 'linux_inet_diag.o' failed
make: *** [linux_inet_diag.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0 for inspection.
Results logged to /home/guy/.rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/raindrops-0.12.0/gem_make.out
Using ref 1.0.5
Using simple_oauth 0.2.0
Using sqlite3 1.3.9
Using subdomain-fu 1.0.0.beta3 from git://github.com/mbleigh/subdomain-fu.git (at master@3752799)
Using useragent 0.14.0
Using will_paginate 3.0.5
Using yui-compressor 0.12.0
Using fission 0.5.0
Using faker 1.3.0
Using i18n-js 3.0.0.rc11
Using memoizable 0.4.2
Using activesupport 4.0.13
Using sitemap_generator 5.0.4
Using rack-test 0.6.3
Using warden 1.2.3
Using mail 2.6.3
Using net-scp 1.2.1
Using nokogiri 1.6.1
Using unf 0.1.4
Using rdoc 4.1.1
Using sprockets 2.11.0
Using httparty 0.13.0
Using faraday 0.9.0
Using coffee-script 2.2.0
Using uglifier 2.5.0
Using less 2.5.0
Using omniauth 1.2.1
Using http 0.5.0
Using pusher 0.14.5
Using rails_12factor 0.0.2
An error occurred while installing raindrops (0.12.0), and Bundler cannot continue.
Make sure that `gem install raindrops -v '0.12.0'` succeeds before bundling.

第3步

我尝试按照gem install raindrops -v '0.12.0'推荐,并收到此错误:

构建原生扩展。这可能需要一段时间......     错误:安装雨滴时出错:         错误:无法构建gem原生扩展。

    current directory: /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0/ext/raindrops
/home/guy/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160816-17818-1jd1xst.rb extconf.rb
checking for mmap() in sys/mman.h... yes
checking for munmap() in sys/mman.h... yes
checking for mremap() in sys/mman.h... yes
checking for getpagesize() in unistd.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_io_blocking_region()... yes
checking for GCC 4+ atomic builtins... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/guy/.rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/raindrops-0.12.0/mkmf.log

current directory: /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0/ext/raindrops
make "DESTDIR=" clean

current directory: /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0/ext/raindrops
make "DESTDIR="
compiling raindrops.c
compiling linux_inet_diag.c
In file included from linux_inet_diag.c:17:0:
/home/guy/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp]
 #warning rubysig.h is obsolete
  ^
linux_inet_diag.c: In function ‘rb_thread_blocking_region’:
linux_inet_diag.c:28:2: error: ‘TRAP_BEG’ undeclared (first use in this function)
  TRAP_BEG;
  ^
linux_inet_diag.c:28:2: note: each undeclared identifier is reported only once for each function it appears in
linux_inet_diag.c:30:2: error: ‘TRAP_END’ undeclared (first use in this function)
  TRAP_END;
  ^
linux_inet_diag.c: At top level:
linux_inet_diag.c:22:1: warning: ‘rb_thread_blocking_region’ defined but not used [-Wunused-function]
 rb_thread_blocking_region(
 ^
Makefile:238: recipe for target 'linux_inet_diag.o' failed
make: *** [linux_inet_diag.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/guy/.rvm/gems/ruby-2.3.1/gems/raindrops-0.12.0 for inspection.
Results logged to /home/guy/.rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/raindrops-0.12.0/gem_make.out

提到这是第二次尝试。在此之前,我发现自己运行了几个gem install xxx推荐,在某些方面我明白这不是方向。其中一些:

gem install sqlite3 -v '1.3.9'
gem install nokogiri -v '1.6.1'
gem install unicorn -v '4.7.0'
gem install therubyracer -v '0.12.1'
gem install nokogumbo -v '1.1.12'

0 个答案:

没有答案