2017-07-07 272 views
-2

我試圖運行軟件包安裝,但是當我這樣做時,出現一條錯誤消息,指出「發生錯誤同時安裝sqlite3(1.3.13),並且Bundler無法繼續。「我試着運行gem install sqlite3 -v'1.3.13',但我也遇到了錯誤。「安裝sqlite3(1.3.13)時發生錯誤,並且Bundler無法繼續」

這裏是我的Gemfile:

source 'https://rubygems.org' 

git_source(:github) do |repo_name| 
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 
    "https://github.com/#{repo_name}.git" 
end 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.1.1' 
# Use Puma as the app server 
gem 'puma', '~> 3.7' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 
# Use Redis adapter to run Action Cable in production 
# gem 'redis', '~> 3.0' 
# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 
    # Use sqlite3 as the database for Active Record 
    gem 'sqlite3' 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
    gem 'web-console', '>= 3.3.0' 
end 

group :production do 
    gem 'pg' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

gem 'jquery-rails' 

gem 'devise' 

這裏是我的錯誤,當我嘗試運行捆綁安裝

[email protected] /c/Sites/my_app (master) 
$ 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 12.0.0 
Using concurrent-ruby 1.0.5 (java) 
Using i18n 0.8.4 
Using minitest 5.10.2 
Using thread_safe 0.3.6 (java) 
Using builder 3.2.3 
Using erubi 1.6.0 
Using nokogiri 1.8.0 (java) 
Using rack 2.0.3 
Using nio4r 2.1.0 (java) 
Using websocket-extensions 0.1.2 
Using mime-types-data 3.2016.0521 
Using arel 8.0.0 
Using bundler 1.15.1 
Using method_source 0.8.2 
Using thor 0.19.4 
Using puma 3.9.1 (java) 
Using sass 3.4.24 
Using tilt 2.0.7 
Using execjs 2.7.0 
Using coffee-script-source 1.12.2 
Using turbolinks-source 5.0.3 
Using multi_json 1.12.1 
Fetching sqlite3 1.3.13 
Installing sqlite3 1.3.13 with native extensions 
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring 
Fetching bindex 0.5.0 
Installing bindex 0.5.0 with native extensions 
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring 
Using bcrypt 3.1.11 (java) 
Using orm_adapter 0.5.0 
Using tzinfo 1.2.3 
Using loofah 2.0.3 
Using rack-test 0.6.3 
Using sprockets 3.7.1 
Using warden 1.2.7 
Using websocket-driver 0.6.5 (java) 
Using mime-types 3.1 
Using uglifier 3.2.0 
Using coffee-script 2.4.1 
Using turbolinks 5.0.1 
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

current directory: 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13/ext/sqlite3 
C:/jruby-9.1.8.0/bin/jruby.exe -r ./siteconf20170707-17112-s04bux.rb extconf.rb 
checking for sqlite3.h... RuntimeError: The compiler failed to generate an 
executable file. 
You have to install development tools first. 

       try_do at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:456 
       try_cpp at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:587 
    block in find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1144 
    block in checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:942 
     block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350 
        open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320 
     block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350 
        open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320 
       postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:346 
      checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:941 
      find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1143 
       <main> at extconf.rb:50 
*** 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}/lib 
     --with-make-prog 
     --without-make-prog 
     --srcdir=. 
     --curdir 
     --ruby=C:/jruby-9.1.8.0/bin/jruby 
     --with-sqlite3-config 
     --without-sqlite3-config 
     --with-pkg-config 
     --without-pkg-config 
     --with-sqlite3-dir 
     --without-sqlite3-dir 
     --with-sqlite3-include 
     --without-sqlite3-include=${sqlite3-dir}/include 
     --with-sqlite3-lib 
     --without-sqlite3-lib=${sqlite3-dir}/lib 

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

C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13 for inspection. 
Results logged to 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/gem_make.out 

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

In Gemfile: 
    sqlite3 

這裏是我的錯誤,當我嘗試運行gem install sqlite -v'1.3.13'

[email protected] /c/Sites/my_app (master) 
$ gem install sqlite3 -v '1.3.13' 
Building native extensions. This could take a while... 
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring 
ERROR: Error installing sqlite3: 
     ERROR: Failed to build gem native extension. 

    current directory: C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13/ext/sqlite3 
C:/jruby-9.1.8.0/bin/jruby.exe -r ./siteconf20170707-17048-ojikan.rb extconf.rb 
checking for sqlite3.h... RuntimeError: The compiler failed to generate an executable file. 
You have to install development tools first. 

       try_do at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:456 
       try_cpp at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:587 
    block in find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1144 
    block in checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:942 
     block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350 
        open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320 
     block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350 
        open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320 
       postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:346 
      checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:941 
      find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1143 
       <main> at extconf.rb:50 
*** 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}/lib 
     --with-make-prog 
     --without-make-prog 
     --srcdir=. 
     --curdir 
     --ruby=C:/jruby-9.1.8.0/bin/jruby 
     --with-sqlite3-config 
     --without-sqlite3-config 
     --with-pkg-config 
     --without-pkg-config 
     --with-sqlite3-dir 
     --without-sqlite3-dir 
     --with-sqlite3-include 
     --without-sqlite3-include=${sqlite3-dir}/include 
     --with-sqlite3-lib 
     --without-sqlite3-lib=${sqlite3-dir}/lib 

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

    C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13 for inspection. 
Results logged to C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/gem_make.out 

任何幫助的讚賞,因爲我不能前進,直到我運行一個成功的捆綁安裝,我已經嘗試了幾天的研究,並不知道如何解決這個問題。

更新17年7月9日:這裏是我的更新的Gemfile在那裏我仍然沒能束運行安裝包也更新:

source 'https://rubygems.org' 

git_source(:github) do |repo_name| 
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 
    "https://github.com/#{repo_name}.git" 
end 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.1.1' 
# Use Puma as the app server 
gem 'puma', '~> 3.7' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 
# Use Redis adapter to run Action Cable in production 
# gem 'redis', '~> 3.0' 
# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 
    # Use sqlite3 as the database for Active Record 
    gem 'sqlite3', platform: :ruby 
    gem 'jdbc-sqlite3', platform: :jruby 
    gem 'activerecord-jdbc-adapter', platform: :jruby 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
    gem 'web-console', '>= 3.3.0' 
end 

group :production do 
    gem 'pg' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

gem 'jquery-rails' 

gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3', '>= 1.3.23' 

更新17年7月10日:除去寶石的ActiveRecord-jdbcsqlite3適配器「,後 '〜> 1.3', '> = 1.3.23',我試圖束再次安裝,這一次,我得到一個不同的錯誤:

[email protected] /c/Sites/my_app (master) 
$ bundle install 
The dependency sqlite3 (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86-mingw32, java but the dependency is only for ruby. To add those platforms to the bundle, run `bundle lock --add-platform ruby`. 
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 12.0.0 
Using concurrent-ruby 1.0.5 (java) 
Using i18n 0.8.4 
Using minitest 5.10.2 
Using thread_safe 0.3.6 (java) 
Using builder 3.2.3 
Using erubi 1.6.0 
Using nokogiri 1.8.0 (java) 
Using rack 2.0.3 
Using nio4r 2.1.0 (java) 
Using websocket-extensions 0.1.2 
Using mime-types-data 3.2016.0521 
Using arel 8.0.0 
Using bundler 1.15.1 
Using method_source 0.8.2 
Using thor 0.19.4 
Using puma 3.9.1 (java) 
Using sass 3.4.24 
Using tilt 2.0.7 
Using execjs 2.7.0 
Using coffee-script-source 1.12.2 
Using turbolinks-source 5.0.3 
Using multi_json 1.12.1 
Using jdbc-sqlite3 3.15.1 
Fetching bindex 0.5.0 
Installing bindex 0.5.0 with native extensions 
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring 
Using tzinfo 1.2.3 
Using loofah 2.0.3 
Using rack-test 0.6.3 
Using sprockets 3.7.1 
Using websocket-driver 0.6.5 (java) 
Using mime-types 3.1 
Using uglifier 3.2.0 
Using coffee-script 2.4.1 
Using turbolinks 5.0.1 
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

current directory: 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0/ext/bindex 
C:/jruby-9.1.8.0/bin/jruby.exe -r ./siteconf20170710-21728-1asiecp.rb extconf.rb 

current directory: 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0/ext/bindex 
make "DESTDIR=" clean 
'make' is not recognized as an internal or external command, 
operable program or batch file. 

current directory: 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0/ext/bindex 
make "DESTDIR=" 
'make' is not recognized as an internal or external command, 
operable program or batch file. 

make failed, exit code 1 

Gem files will remain installed in 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0 for inspection. 
Results logged to 
C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/bindex-0.5.0/gem_make.out 

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

In Gemfile: 
    web-console was resolved to 3.5.1, which depends on 
    bindex 
+0

您正在運行'gem installsqlite3 -v'1.1.13''並且需要一個空格'gem install sqlite3 -v'1.1.13'' – jdgray

+0

啊是的。我只是增加了一個空間,但我仍然收到錯誤。當我添加空間並嘗試再次運行時,我更新了我的問題以顯示錯誤。 – kellya

+0

'RuntimeError:編譯器無法生成可執行文件。你必須先安裝開發工具。「----'爲了看看爲什麼這個擴展名無法編譯,請檢查可以在這裏找到的mkmf.log:C:/jruby-9.1.8.0/lib/ruby/gems/共享/擴展/通用的Java-1.8/2.3.0/sqlite3-1.3.13/MKMF。可能在這兩個之間你可以找出解決方案 –

回答

1

Gem activerecord-jdbcsqlite3-adapter尚未與Rails 5兼容。我幾年前就成功地使用JRuby和Rails 4.1.3。從事JDBC適配器的團隊是在開源的基礎上運行的,這一般意味着他們可以免費工作,so you get what you get

你有兩個選擇:

1)卸載JRuby和Rails的使用5基於MRI解釋器;或者

2)使用JRuby和老版本的Rails,比如4.2.9或更低版本。

我的建議是堅持選項1,因爲你根本不需要做任何特別的事--MRI是普通的Ruby解釋器。你也從來沒有解釋過你選擇JRuby的原因,這讓我懷疑是XY Problem。如果您選擇第2項,請查看您選擇JRuby的原因,並確保您知道自己在做什麼以及爲什麼要這麼做。

+0

感謝您的回覆!凡在我的Gemfile做我把: 寶石 '的sqlite3',平臺:紅寶石 寶石 'JDBC-sqlite3的' 平臺:JRuby的 寶石的ActiveRecord-JDBC適配器「,平臺:JRuby的 我怎麼知道我的數據庫名稱是什麼? 最後,當試圖運行rails server時出現錯誤: 在您的任何gem源中找不到gem'activerecord-jdbcsqlite3-adapter(> = 1.3.23,〜> 1.3)x86-mingw32'的Gemfile。 運行'bundle install'安裝缺失的寶石。 嘗試運行捆綁軟件安裝,但它要求我運行捆綁更新,這是我做的,但後來它要求我運行捆綁軟件安裝。 – kellya

+0

沒有找到寶石,因爲你沒有改變你的寶石文件。將該片段包含在gemfile的開發塊中,然後運行bundle install。此外,發佈您的gemfile更新,因爲我懷疑你已經在原始發佈和現在之間更新了它,但是你沒有說明它是否或如何改變。 – MarsAtomic

+0

請參閱上面的我已更新的Gemfile @MarsAtomic – kellya

相關問題