2016-08-29 87 views
0

嗨!bundler:未能加載命令:spring(/ bin/spring)

當我試圖在軌道上建立一個新的項目與MySQL

rails new appnameywea --database mysql 

其失敗

create 
    create README.rdoc 
    create Rakefile 
    create config.ru 
    create .gitignore 
    create Gemfile 
    create app 
    create app/assets/javascripts/application.js 
    create app/assets/stylesheets/application.css 
    create app/controllers/application_controller.rb 
    create app/helpers/application_helper.rb 
    create app/views/layouts/application.html.erb 
    create app/assets/images/.keep 
    create app/mailers/.keep 
    create app/models/.keep 
    create app/controllers/concerns/.keep 
    create app/models/concerns/.keep 
    create bin 
    create bin/bundle 
    create bin/rails 
    create bin/rake 
    create bin/setup 
    create config 
    create config/routes.rb 
    create config/application.rb 
    create config/environment.rb 
    create config/secrets.yml 
    create config/environments 
    create config/environments/development.rb 
    create config/environments/production.rb 
    create config/environments/test.rb 
    create config/initializers 
    create config/initializers/assets.rb 
    create config/initializers/backtrace_silencers.rb 
    create config/initializers/cookies_serializer.rb 
    create config/initializers/filter_parameter_logging.rb 
    create config/initializers/inflections.rb 
    create config/initializers/mime_types.rb 
    create config/initializers/session_store.rb 
    create config/initializers/wrap_parameters.rb 
    create config/locales 
    create config/locales/en.yml 
    create config/boot.rb 
    create config/database.yml 
    create db 
    create db/seeds.rb 
    create lib 
    create lib/tasks 
    create lib/tasks/.keep 
    create lib/assets 
    create lib/assets/.keep 
    create log 
    create log/.keep 
    create public 
    create public/404.html 
    create public/422.html 
    create public/500.html 
    create public/favicon.ico 
    create public/robots.txt 
    create test/fixtures 
    create test/fixtures/.keep 
    create test/controllers 
    create test/controllers/.keep 
    create test/mailers 
    create test/mailers/.keep 
    create test/models 
    create test/models/.keep 
    create test/helpers 
    create test/helpers/.keep 
    create test/integration 
    create test/integration/.keep 
    create test/test_helper.rb 
    create tmp/cache 
    create tmp/cache/assets 
    create vendor/assets/javascripts 
    create vendor/assets/javascripts/.keep 
    create vendor/assets/stylesheets 
    create vendor/assets/stylesheets/.keep 
    run 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.2.2 
Using i18n 0.7.0 
Using json 1.8.3 
Using minitest 5.9.0 
Using thread_safe 0.3.5 
Using builder 3.2.2 
Using erubis 2.7.0 
Using nokogiri 1.6.8 
Using rack 1.6.4 
Using mime-types-data 3.2016.0521 
Using arel 6.0.3 
Using debug_inspector 0.0.2 
Using bundler 1.12.5 
Using byebug 9.0.5 
Using coffee-script-source 1.10.0 
Using execjs 2.7.0 
Using thor 0.19.1 
Using concurrent-ruby 1.0.2 
Using multi_json 1.12.1 
Installing mysql2 0.4.4 with native extensions 

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

current directory: /home/yukan/.gem/ruby/gems/mysql2-0.4.4/ext/mysql2 
/usr/bin/ruby -r ./siteconf20160828-12619-1uphiih.rb extconf.rb 
checking for ruby/thread.h... *** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary 
libraries and/or headers. Check the mkmf.log file for more details. You may 
need configuration options. 

Provided configuration options: 
--with-opt-dir 
--without-opt-dir 
--with-opt-include 
--without-opt-include=${opt-dir}/include 
--with-opt-lib 
--without-opt-lib=${opt-dir}/lib64 
--with-make-prog 
--without-make-prog 
--srcdir=. 
--curdir 
--ruby=/usr/bin/$(RUBY_BASE_NAME) 
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
from /usr/share/ruby/mkmf.rb:587:in `try_cpp' 
from /usr/share/ruby/mkmf.rb:1091:in `block in have_header' 
from /usr/share/ruby/mkmf.rb:942:in `block in checking_for' 
from /usr/share/ruby/mkmf.rb:350:in `block (2 levels) in postpone' 
from /usr/share/ruby/mkmf.rb:320:in `open' 
from /usr/share/ruby/mkmf.rb:350:in `block in postpone' 
from /usr/share/ruby/mkmf.rb:320:in `open' 
from /usr/share/ruby/mkmf.rb:346:in `postpone' 
from /usr/share/ruby/mkmf.rb:941:in `checking_for' 
from /usr/share/ruby/mkmf.rb:1090:in `have_header' 
from extconf.rb:16:in `<main>' 

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

    /home/yukan/.gem/ruby/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /home/yukan/.gem/ruby/gems/mysql2-0.4.4 for inspection. 
Results logged to /home/yukan/.gem/ruby/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/gem_make.out 
Using sass 3.4.22 
Using tilt 2.0.5 
Using spring 1.7.2 
Using turbolinks-source 5.0.0 
Using rdoc 4.2.2 
Using tzinfo 1.2.2 
Using loofah 2.0.3 
Using rack-test 0.6.3 
Using mime-types 3.1 
Using binding_of_caller 0.7.2 
Using coffee-script 2.4.1 
Using uglifier 3.0.2 
Using sprockets 3.7.0 
An error occurred while installing mysql2 (0.4.4), and Bundler cannot 
continue. 
Make sure that `gem install mysql2 -v '0.4.4'` succeeds before bundling. 
    run bundle exec spring binstub --all 
Bundler::GemNotFound: Could not find gem 'mysql2 (< 0.5, >= 0.3.13)' in any of the gem sources listed in your Gemfile or available on this machine. 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/resolver.rb:356:in `block in verify_gemfile_dependencies_are_found!' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/resolver.rb:331:in `each' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/resolver.rb:331:in `verify_gemfile_dependencies_are_found!' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/resolver.rb:200:in `start' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/resolver.rb:184:in `resolve' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/definition.rb:200:in `resolve' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/definition.rb:185:in `specs_for' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/definition.rb:174:in `requested_specs' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/environment.rb:19:in `requested_specs' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/runtime.rb:14:in `setup' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler.rb:95:in `setup' 
    /home/yukan/.gem/ruby/gems/bundler-1.12.5/lib/bundler/setup.rb:19:in `<top (required)>' 
    /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' 
    /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' 
    bundler: failed to load command: spring (/bin/spring) 

當我運行這個...

gem install mysql2 -v '0.4.4' 
    Building native extensions. This could take a while... 
    ERROR: Error installing mysql2: 
    ERROR: Failed to build gem native extension. 

current directory: /home/yukan/.gem/ruby/gems/mysql2-0.4.4/ext/mysql2 
/usr/bin/ruby -r ./siteconf20160828-13121-162bkye.rb extconf.rb 
checking for ruby/thread.h... *** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary 
libraries and/or headers. Check the mkmf.log file for more details. You may 
need configuration options. 

Provided configuration options: 
--with-opt-dir 
--without-opt-dir 
--with-opt-include 
--without-opt-include=${opt-dir}/include 
--with-opt-lib 
--without-opt-lib=${opt-dir}/lib64 
--with-make-prog 
--without-make-prog 
--srcdir=. 
--curdir 
--ruby=/usr/bin/$(RUBY_BASE_NAME) 
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate     an executable file. (RuntimeError) 
You have to install development tools first. 
from /usr/share/ruby/mkmf.rb:587:in `try_cpp' 
from /usr/share/ruby/mkmf.rb:1091:in `block in have_header' 
from /usr/share/ruby/mkmf.rb:942:in `block in checking_for' 
from /usr/share/ruby/mkmf.rb:350:in `block (2 levels) in postpone' 
from /usr/share/ruby/mkmf.rb:320:in `open' 
from /usr/share/ruby/mkmf.rb:350:in `block in postpone' 
from /usr/share/ruby/mkmf.rb:320:in `open' 
from /usr/share/ruby/mkmf.rb:346:in `postpone' 
from /usr/share/ruby/mkmf.rb:941:in `checking_for' 
from /usr/share/ruby/mkmf.rb:1090:in `have_header' 
from extconf.rb:16:in `<main>' 

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

    /home/yukan/.gem/ruby/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/mkmf.log 

extconf failed, exit code 1 

    Gem files will remain installed in /home/yukan/.gem/ruby/gems/mysql2-0.4.4 for inspection. 
    Results logged to /home/yukan/.gem/ruby/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/gem_make.out 

總之,它無法加載'spring'命令,並且...我知道它是什麼,但我不知道如何修復它。

我是這個新手,我不知道我在做什麼,所以請,對不起,如果這個問題是顯而易見的!

PS:是的,我安裝「寶石mysql2」
PS2:在「捆綁安裝」也失敗了同樣的問題:春天
PS3:我想沒有--database mysql和爆炸,因爲創建一個項目沒有'gem mysql2'當我安裝了它們; - ;

回答

0

我想你錯過了圖書館libmysqlclient-dev

嘗試通過命令來安裝:

sudo apt-get install libmysqlclient-dev

+0

嗷,我的錯! 我工作在Fedora 24,所以,我搜索有關該rpm,我發現這... https://dev.mysql.com/downloads/file/?id=456207 我嘗試安裝它,我有衝突,但... thx的幫助 –