我如下尝试了bundle install
,但没有成功。
我尝试了很多在这里和那里找到的方法:
请注意,我是 Ruby 的新手,因此它可能是一些简单的解决方案。例如,我应该以某种方式解释捆绑软件以使用1.8.6。,但是我不知道如何使用它。
sudo bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/.........
rails (3.2.14) has dependency bundler (~> 1.0), which is unsatisfied by the current bundler version 2.0.1, so the dependency is being ignored
Using rake 10.1.0
Using clive 1.2.0
Using process_runner 0.0.2
Using rake-compiler 0.9.1
Using timers 1.1.0
Using celluloid 0.14.1
Using contextual_exceptions 0.0.2
Using bundler 2.0.1
Using methadone 1.3.0
Using i18n 0.6.5
Using multi_json 1.7.9
Using activesupport 3.2.14
Using builder 3.0.4
Using activemodel 3.2.14
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.2
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.2.2
Using actionpack 3.2.14
Using mime-types 1.23
Using polyglot 0.3.3
Using treetop 1.4.14
Using mail 2.5.4
Using actionmailer 3.2.14
Using arel 3.0.2
Using tzinfo 0.3.37
Using activerecord 3.2.14
Using activeresource 3.2.14
Using awesome_print 1.1.0
Using coderay 1.0.9
Using better_errors 0.9.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using rack-ssl 1.3.3
Fetching json 1.8.0
Installing json 1.8.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.0/ext/json/ext/generator
/home/vagrant/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20190205-9598-qp91k4.rb extconf.rb
creating Makefile
current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
Makefile:238: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.0 for inspection.
Results logged to
/home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/json-1.8.0/gem_make.out
An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
blueprint-rails was resolved to 0.2.0, which depends on
railties was resolved to 3.2.14, which depends on
rdoc was resolved to 3.12.2, which depends on
json
vagrant@vagrant:~/
任何帮助将不胜感激。
谢谢!
更新1:
bundle update json
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
methadone was resolved to 1.3.0, which depends on
bundler
rails (~> 3.2) was resolved to 3.2.14, which depends on
bundler (~> 1.0)
Current Bundler version:
bundler (2.0.1)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (~> 1.0)', which is required by gem 'rails (~> 3.2)', in any of the sources.
更新2:
gem uninstall bundler
Select gem to uninstall:
1. bundler-1.0.10
2. bundler-2.0.1
3. All versions
> 2
You have requested to uninstall the gem:
bundler-2.0.1
rails-5.2.2 depends on bundler (>= 1.3.0)
rails-dom-testing-2.0.3 depends on bundler (>= 1.3, development)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
更新3:
sudo bundle update json
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 10.1.0
Using clive 1.2.0
Using process_runner 0.0.2
Using timers 1.1.0
Using contextual_exceptions 0.0.2
Using bundler 1.14.6
Using i18n 0.6.5
Using multi_json 1.7.9
Using builder 3.0.4
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using hike 1.2.3
Using tilt 1.4.1
Using mime-types 1.23
Using polyglot 0.3.3
Using arel 3.0.2
Using tzinfo 0.3.37
Using awesome_print 1.1.0
Using coderay 1.0.9
Using debug_inspector 0.0.2
Using json 1.8.6 (was 1.8.0)
Using thor 0.18.1
Using sass 3.2.10
Using callsite 0.0.11
Using mini_portile 0.5.1
Using chunky_png 1.2.8
Using client_side_validations 3.2.6
Using moped 1.4.5
Using origin 1.0.11
Using coffee-script-source 1.6.3
Using haml 3.1.8
Using fssm 0.2.10
Using connection_pool 1.1.0
Using daemon_controller 1.1.5
Using daemons 1.1.9
Using diff-lcs 1.2.4
Installing eventmachine 1.0.3 with native extensions
Using god 0.13.2
Using kramdown 1.1.0
Using metaclass 0.0.1
Using redis 3.0.4
Using require_reloader 0.2.0
Using rspec-core 2.14.5
Using rspec-mocks 2.14.3
Using yard 0.8.7
Using rake-compiler 0.9.1
Using celluloid 0.14.1
Using methadone 1.3.0
Using activesupport 3.2.14
Using execjs 1.4.0
Using rack-cache 1.2
Using rack-test 0.6.2
Using rack-ssl 1.3.3
Using rack-contrib 1.1.0
Using sprockets 2.2.2
Using treetop 1.4.14
Using better_errors 0.9.0
Using binding_of_caller 0.7.2
Using rdoc 3.12.2
Using zen-grids 1.4
Using nokogiri 1.6.0
Using oily_png 1.1.0
Using compass 0.12.2
Using passenger 4.0.10
Using rspec-expectations 2.14.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.3/ext
/home/vagrant/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20190205-23731-qe1gp5.rb extconf.rb
checking for main() in -lssl... yes
checking for main() in -lcrypto... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
^
Makefile:230: recipe for target 'em.o' failed
make: *** [em.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.3 for
inspection.
Results logged to
/home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/eventmachine-1.0.3/gem_make.out
An error occurred while installing eventmachine (1.0.3), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.
解决方案: 下面的mjr答案是一个有效的解决方案,尽管降级Ruby也可以解决此问题。
答案 0 :(得分:2)
尝试运行bundle update json
以强制更新json
gem。如果这不起作用,则可以运行gem clean
,删除Gemfile.lock
,然后再次运行所有内容。
编辑:看来您的捆绑器版本与您的rails版本不兼容。您可以尝试通过运行以下命令来降低捆绑程序的等级:
gem install bundler --version '1.14.6'
gem uninstall bundler --version '2.0.1'
这也是一个新项目吗?如果是这样,则应考虑使用滑轨5。滑轨3接近三个主要版本,而滑轨6的释放距离也不太远。这样也可以避免很多此类宝石问题。