简体   繁体   English

RoR Michael Hartl Tutorial (3rd) - 安装 sqlite3 时出错,Bundler 无法继续

[英]RoR Michael Hartl Tutorial (3rd) - An error occurred while installing sqlite3, and Bundler cannot continue

Others have asked a similar questions before but none have been using the cloud9 IDE.其他人之前也问过类似的问题,但没有人使用过 cloud9 IDE。 I have tried solutions to other questions, but still can't get it to work.我已经尝试了其他问题的解决方案,但仍然无法让它发挥作用。

I am doing the Michael Hartl Ruby on Rails Tutorial (3rd) and using the cloud9 IDE (as I run Windows OS).我正在做 Michael Hartl Ruby on Rails 教程(第 3 期)并使用 cloud9 IDE(当我运行 Windows 操作系统时)。

When I try to push my master branch from Bitbucket to Heroku.当我尝试将我的主分支从 Bitbucket 推送到 Heroku 时。

$ git push heroku master

I get the error:我收到错误:

An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.

I appreciate that Heroku does not support sqlite.我很欣赏 Heroku 不支持 sqlite。 But I have followed the tutorial very closely.但我非常密切地遵循教程。 And I can't see where I have gone wrong.而且我看不出我哪里出错了。

Here is the full code:这是完整的代码:

kpscowley:~/workspace/hello_app2 (master) $ git push heroku master
Counting objects: 66, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (55/55), done.
Writing objects: 100% (66/66), 16.75 KiB | 0 bytes/s, done.
Total 66 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using bundler 1.9.7
remote:        Running: bundle install --without development:test --path             vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Fetching gem metadata from https://rubygems.org/...........
remote:        Fetching version metadata from https://rubygems.org/...
remote:        Fetching dependency metadata from https://rubygems.org/..
remote:        Rubygems 2.0.14.1 is not threadsafe, so your gems must be     installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel     gem installation.
remote:        Installing rake 10.4.2
remote:        Installing i18n 0.7.0
remote:        Installing json 1.8.3
remote:        Installing minitest 5.8.3
remote:        Installing thread_safe 0.3.5
remote:        Installing tzinfo 1.2.2
remote:        Installing activesupport 4.2.2
remote:        Installing builder 3.2.2
remote:        Installing erubis 2.7.0
remote:        Installing mini_portile2 2.0.0
remote:        Installing nokogiri 1.6.7.1
remote:        Installing rails-deprecated_sanitizer 1.0.3
remote:        Installing rails-dom-testing 1.0.7
remote:        Installing loofah 2.0.3
remote:        Installing rails-html-sanitizer 1.0.2
remote:        Installing actionview 4.2.2
remote:        Installing rack 1.6.4
remote:        Installing rack-test 0.6.3
remote:        Installing actionpack 4.2.2
remote:        Installing globalid 0.3.6
remote:        Installing activejob 4.2.2
remote:        Installing mime-types 2.99
remote:        Installing mail 2.6.3
remote:        Installing actionmailer 4.2.2
remote:        Installing activemodel 4.2.2
remote:        Installing arel 6.0.3
remote:        Installing activerecord 4.2.2
remote:        Installing coffee-script-source 1.10.0
remote:        Installing execjs 2.6.0
remote:        Installing coffee-script 2.4.1
remote:        Installing thor 0.19.1
remote:        Installing railties 4.2.2
remote:        Installing coffee-rails 4.1.1
remote:        Installing concurrent-ruby 1.0.0
remote:        Installing multi_json 1.11.2
remote:        Installing jbuilder 2.3.2
remote:        Installing jquery-rails 4.0.5
remote:        Using bundler 1.9.7
remote:        Installing sprockets 3.5.2
remote:        Installing sprockets-rails 3.0.0
remote:        Installing rails 4.2.2
remote:        Installing rdoc 4.2.1
remote:        Installing sass 3.4.20
remote:        Installing tilt 2.0.1
remote:        Installing sass-rails 5.0.4
remote:        Installing sdoc 0.4.1
remote:        Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
remote:        /tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/ruby-2.0.0/bin/ruby extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'port install sqlite3 +universal',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
remote:        and check your shared library search path (the
remote:        location where your sqlite3 shared library is located).
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:        Provided configuration options:
remote:        --with-opt-dir
remote:        --without-opt-dir
remote:        --with-opt-include
remote:        --without-opt-include=${opt-dir}/include
remote:        --with-opt-lib
remote:        --without-opt-lib=${opt-dir}/lib
remote:        --with-make-prog
remote:        --without-make-prog
remote:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/ruby-2.0.0/bin/ruby
remote:        --with-sqlite3-dir
remote:        --without-sqlite3-dir
remote:        --with-sqlite3-include
remote:        --without-sqlite3-include=${sqlite3-dir}/include
remote:        --with-sqlite3-lib
remote:        --without-sqlite3-lib=${sqlite3-dir}/
remote:        Gem files will remain installed in /tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11 for inspection.
remote:        Results logged to /tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11/ext/sqlite3/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote:        Bundler Output: Fetching gem metadata from https://rubygems.org/...........
remote:        Fetching version metadata from https://rubygems.org/...
remote:        Fetching dependency metadata from https://rubygems.org/..
remote:        Rubygems 2.0.14.1 is not threadsafe, so your gems must be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
remote:        Installing rake 10.4.2
remote:        Installing i18n 0.7.0
remote:        Installing json 1.8.3
remote:        Installing minitest 5.8.3
remote:        Installing thread_safe 0.3.5
remote:        Installing tzinfo 1.2.2
remote:        Installing activesupport 4.2.2
remote:        Installing builder 3.2.2
remote:        Installing erubis 2.7.0
remote:        Installing mini_portile2 2.0.0
remote:        Installing nokogiri 1.6.7.1
remote:        Installing rails-deprecated_sanitizer 1.0.3
remote:        Installing rails-dom-testing 1.0.7
remote:        Installing loofah 2.0.3
remote:        Installing rails-html-sanitizer 1.0.2
remote:        Installing actionview 4.2.2
remote:        Installing rack 1.6.4
remote:        Installing rack-test 0.6.3
remote:        Installing actionpack 4.2.2
remote:        Installing globalid 0.3.6
remote:        Installing activejob 4.2.2
remote:        Installing mime-types 2.99
remote:        Installing mail 2.6.3
remote:        Installing actionmailer 4.2.2
remote:        Installing activemodel 4.2.2
remote:        Installing arel 6.0.3
remote:        Installing activerecord 4.2.2
remote:        Installing coffee-script-source 1.10.0
remote:        Installing execjs 2.6.0
remote:        Installing coffee-script 2.4.1
remote:        Installing thor 0.19.1
remote:        Installing railties 4.2.2
remote:        Installing coffee-rails 4.1.1
remote:        Installing concurrent-ruby 1.0.0
remote:        Installing multi_json 1.11.2
remote:        Installing jbuilder 2.3.2
remote:        Installing jquery-rails 4.0.5
remote:        Using bundler 1.9.7
remote:        Installing sprockets 3.5.2
remote:        Installing sprockets-rails 3.0.0
remote:        Installing rails 4.2.2
remote:        Installing rdoc 4.2.1
remote:        Installing sass 3.4.20
remote:        Installing tilt 2.0.1
remote:        Installing sass-rails 5.0.4
remote:        Installing sdoc 0.4.1
remote:        
remote:        Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
remote:        
remote:        /tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/ruby-2.0.0/bin/ruby extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'port install sqlite3 +universal',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
remote:        and check your shared library search path (the
remote:        location where your sqlite3 shared library is located).
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:        
remote:        Provided configuration options:
remote:        --with-opt-dir
remote:        --without-opt-dir
remote:        --with-opt-include
remote:        --without-opt-include=${opt-dir}/include
remote:        --with-opt-lib
remote:        --without-opt-lib=${opt-dir}/lib
remote:        --with-make-prog
remote:        --without-make-prog
remote:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/ruby-2.0.0/bin/ruby
remote:        --with-sqlite3-dir
remote:        --without-sqlite3-dir
remote:        --with-sqlite3-include
remote:        --without-sqlite3-include=${sqlite3-dir}/include
remote:        --with-sqlite3-lib
remote:        --without-sqlite3-lib=${sqlite3-dir}/
remote:        
remote:        
remote:        Gem files will remain installed in /tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11 for inspection.
remote:        Results logged to /tmp/build_287067056d8f395e2b2b5684ca54eff3/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11/ext/sqlite3/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     
remote:  !     Detected sqlite3 gem which is not supported on Heroku.
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy...
remote: 
remote: !       Push rejected to powerful-reaches-4422.
remote: 
To https://git.heroku.com/powerful-reaches-4422.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/powerful-reaches-4422.git'

Also please see my Gemfile:另请参阅我的 Gemfile:

source 'https://rubygems.org'

gem 'rails',        '4.2.2'
gem 'sass-rails',   '5.0.2'
gem 'uglifier',     '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks',   '2.3.0'
gem 'jbuilder',     '2.2.3'
gem 'sdoc',         '0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3',     '1.3.9
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
end

And Gemfile.lock:和 Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
actionmailer (4.2.2)
  actionpack (= 4.2.2)
  actionview (= 4.2.2)
  activejob (= 4.2.2)
  mail (~> 2.5, >= 2.5.4)
  rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.2)
  actionview (= 4.2.2)
  activesupport (= 4.2.2)
  rack (~> 1.6)
  rack-test (~> 0.6.2)
  rails-dom-testing (~> 1.0, >= 1.0.5)
  rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.2)
  activesupport (= 4.2.2)
  builder (~> 3.1)
  erubis (~> 2.7.0)
  rails-dom-testing (~> 1.0, >= 1.0.5)
  rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.2)
  activesupport (= 4.2.2)
  globalid (>= 0.3.0)
activemodel (4.2.2)
  activesupport (= 4.2.2)
  builder (~> 3.1)
activerecord (4.2.2)
  activemodel (= 4.2.2)
  activesupport (= 4.2.2)
  arel (~> 6.0)
activesupport (4.2.2)
  i18n (~> 0.7)
  json (~> 1.7, >= 1.7.7)
  minitest (~> 5.1)
  thread_safe (~> 0.3, >= 0.3.4)
  tzinfo (~> 1.1)
arel (6.0.3)
binding_of_caller (0.7.2)
  debug_inspector (>= 0.0.1)
builder (3.2.2)
byebug (8.2.1)
coffee-rails (4.1.1)
  coffee-script (>= 2.2.0)
  railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
  coffee-script-source
  execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.0)
debug_inspector (0.0.2)
erubis (2.7.0)
execjs (2.6.0)
globalid (0.3.6)
  activesupport (>= 4.1.0)
i18n (0.7.0)
jbuilder (2.3.2)
  activesupport (>= 3.0.0, < 5)
  multi_json (~> 1.2)
jquery-rails (4.0.5)
  rails-dom-testing (~> 1.0)
  railties (>= 4.2.0)
  thor (>= 0.14, < 2.0)
json (1.8.3)
loofah (2.0.3)
  nokogiri (>= 1.5.9)
mail (2.6.3)
  mime-types (>= 1.16, < 3)
mime-types (2.99)
mini_portile2 (2.0.0)
minitest (5.8.3)
multi_json (1.11.2)
nokogiri (1.6.7.1)
  mini_portile2 (~> 2.0.0.rc2)
rack (1.6.4)
rack-test (0.6.3)
  rack (>= 1.0)
rails (4.2.2)
  actionmailer (= 4.2.2)
  actionpack (= 4.2.2)
  actionview (= 4.2.2)
  activejob (= 4.2.2)
  activemodel (= 4.2.2)
  activerecord (= 4.2.2)
  activesupport (= 4.2.2)
  bundler (>= 1.3.0, < 2.0)
  railties (= 4.2.2)
  sprockets-rails
rails-deprecated_sanitizer (1.0.3)
  activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
  activesupport (>= 4.2.0.beta, < 5.0)
  nokogiri (~> 1.6.0)
  rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
  loofah (~> 2.0)
railties (4.2.2)
  actionpack (= 4.2.2)
  activesupport (= 4.2.2)
  rake (>= 0.8.7)
  thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.1)
  json (~> 1.4)
sass (3.4.20)
sass-rails (5.0.4)
  railties (>= 4.0.0, < 5.0)
  sass (~> 3.1)
  sprockets (>= 2.8, < 4.0)
  sprockets-rails (>= 2.0, < 4.0)
  tilt (>= 1.1, < 3)
sdoc (0.4.1)
  json (~> 1.7, >= 1.7.7)
  rdoc (~> 4.0)
spring (1.6.1)
sprockets (3.5.2)
  concurrent-ruby (~> 1.0)
  rack (> 1, < 3)
sprockets-rails (3.0.0)
  actionpack (>= 4.0)
  activesupport (>= 4.0)
  sprockets (>= 3.0.0)
sqlite3 (1.3.11)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1)
turbolinks (2.5.3)
  coffee-rails
tzinfo (1.2.2)
  thread_safe (~> 0.1)
uglifier (2.7.2)
  execjs (>= 0.3.0)
  json (>= 1.8.0)
web-console (2.2.1)
  activemodel (>= 4.0)
  binding_of_caller (>= 0.7.2)
  railties (>= 4.0)
  sprockets-rails (>= 2.0, < 4.0)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  coffee-rails (~> 4.1.0)
  jbuilder (~> 2.0)
  jquery-rails
  rails (= 4.2.2)
  sass-rails (~> 5.0)
  sdoc (~> 0.4.0)
  spring
  sqlite3
  turbolinks
  uglifier (>= 1.3.0)
  web-console (~> 2.0)

Any help would be much appreciated, thanks.任何帮助将不胜感激,谢谢。

Heroku works only with PostgreSQL. Heroku 仅适用于 PostgreSQL。 You can continue to use sqlite3 locally, but you need to switch to pg on Heroku.本地可以继续使用sqlite3 ,但是需要在Heroku上切换pg

group :development, :test do
    gem 'sqlite3'
    end
group :production do
  gem 'pg'
end

Then delete然后删除

`Gemfile.lock`

Then run然后运行

bundle install --without production

Do not forget to commit both Gemfile and Gemfile.lock to the local master before pushing to Heroku.在推送到 Heroku 之前,不要忘记将GemfileGemfile.lock提交给本地 master。

did you update your Gemfile.lock before pushing?你在Gemfile.lock之前更新了你的Gemfile.lock吗? if not to update it run bundle update .如果不更新它run bundle update good luck mate!祝你好运!

Reading the same book!读同一本书! I experienced the same issue.我遇到了同样的问题。 I fixed it by making sure the gems outside the groups in the Gemfile file did not include sqlite3 (above of development and production), sqlite 3 should only be placed once and under the development group.我通过确保 Gemfile 文件中组外的 gems 不包含 sqlite3(开发和生产之上)来修复它,sqlite 3 应该只放置一次并且在开发组下。 If you tried to deploy you app to heroku it can cause issues.如果您尝试将应用程序部署到 heroku,它可能会导致问题。 To fix it, make sure sqlite is only listed like:要修复它,请确保只列出 sqlite,如下所示:

group :development, :test do

 .
 .
gem 'sqlite3'
 .
 .

end

and then proceed delete the Gemfile.lock (since a mistake was made, sqlite3 will be listed as a dependency in the Gemfile.lock and it will need to be re-created was deleted by doing a bundle install), next do a bundle install:然后继续删除Gemfile.lock(因为犯了错误,sqlite3将被列为Gemfile.lock的依赖项,需要重新创建,通过捆绑安装删除),接下来进行捆绑安装:

bundle install --without production

(--without production is placed so we don't install locally gems that we wont need) Finish by adding, committing and pushing your changes and then deploying it to heroku. ( --without production 被放置,所以我们不会在本地安装我们不需要的 gem) 通过添加、提交和推送您的更改,然后将其部署到 heroku 来完成。 You shouldn't have any issues now.你现在应该没有任何问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装sqlite3(1.3.13)时发生错误,并且Bundler无法继续 - An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue “安装sqlite3(1.3.13)时发生错误,并且Bundler无法继续” - “An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue” 安装sqlite3(1.3.11)时出错,Bundler无法继续 - An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue 安装 sqlite3 (1.3.7) 时出错,Bundler 无法继续无法创建 rails 应用程序 - An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue Cannot create rails app Rails - 错误“安装 sqlite3 (1.3.13) 时出错,Bundler 无法继续” - Rails - error " An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue" Windows 10上的Rails错误(安装sqlite3(1.4.1)时发生错误,并且Bundler无法继续) - Rails error on windows 10 (An error occurred while installing sqlite3 (1.4.1), and Bundler cannot continue) Rails教程:“安装ffi(1.9.10)时发生错误,并且Bundler无法继续。” - Rails tutorial: “An error occurred while installing ffi (1.9.10), and Bundler cannot continue.” 安装bcrypt(3.1.11)时发生错误,Bundler无法继续。 - An error occurred while installing bcrypt (3.1.11), and Bundler cannot continue. 安装mysql2(0.3.21)时出错,Bundler无法继续 - An error occurred while installing mysql2 (0.3.21), and Bundler cannot continue 安装pg(1.1.4)时发生错误,并且Bundler无法继续 - An error occurred while installing pg (1.1.4), and Bundler cannot continue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM