简体   繁体   English

Rails - 错误“安装 sqlite3 (1.3.13) 时出错,Bundler 无法继续”

[英]Rails - error " An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue"

I am totally new to Git and Ruby on Rails and I'm doing the "The Odin Project", but I've got stucked.我是 Git 和 Ruby on Rails 的新手,我正在做“The Odin 项目”,但我被卡住了。

I am trying to deploy the application I've created, using Git to push the master branch up to Heroku.我正在尝试部署我创建的应用程序,使用 Git 将 master 分支推送到 Heroku。

When I run the command "git push heroku master" I get this log with the follwing mistakes, what it may be?当我运行命令“git push heroku master”时,我得到了带有以下错误的日志,它可能是什么?

matteo@matteo-VirtualBox:~/railsbridge/hello_app$ git push heroku master
Counting objects: 90, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (76/76), done.
Writing objects: 100% (90/90), 22.03 KiB | 0 bytes/s, done.
Total 90 (delta 6), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:             Detected buildpacks: Ruby,Node.js
remote:             See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.4
remote: -----> Installing dependencies using bundler 1.15.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.15.4). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
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:        Fetching rake 12.1.0
remote:        Installing concurrent-ruby 1.0.5
remote:        Fetching minitest 5.10.3
....
remote:        Installing turbolinks 5.0.1
remote:        Fetching activesupport 5.1.4
remote:        The latest bundler is 1.16.0.pre.3, but you are currently running 1.15.2.
remote:        To update, run `gem install bundler --pre`
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        current directory:
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/ruby-2.3.4/bin/ruby -r
remote:        ./siteconf20171015-278-1swne7x.rb extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'brew install sqlite3',
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:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote:        --with-sqlite3-config
remote:        --without-sqlite3-config
remote:        --without-sqlite3-lib=${sqlite3-dir}/lib
remote:        To see why this extension failed to compile, please check the mkmf.log which can
remote:        be found here:
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
remote:        extconf failed, exit code 1
remote:        Gem files will remain installed in
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.
remote:        In Gemfile:
remote:        sqlite3
remote:        Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.15.4). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
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:        Fetching rake 12.1.0
remote:        Fetching concurrent-ruby 1.0.5
1.4
remote:        Fetching rb-inotify 0.9.10
remote:        Installing rb-inotify 0.9.10
remote:        The latest bundler is 1.16.0.pre.3, but you are currently running 1.15.2.
remote:        To update, run `gem install bundler --pre`
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        
remote:        current directory:
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/ruby-2.3.4/bin/ruby -r
remote:        ./siteconf20171015-278-1swne7x.rb extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'brew install sqlite3',
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:        --ruby=/tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote:        --with-sqlite3-config
remote:        --without-sqlite3-lib=${sqlite3-dir}/lib
remote:        
remote:        To see why this extension failed to compile, please check the mkmf.log which can
remote:        be found here:
remote:        
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
remote:        
remote:        extconf failed, exit code 1
remote:        
remote:        Gem files will remain installed in
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_c400101f4282a4c7d4222ce20d2d35b2/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
remote:        
remote:        An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.
remote:        
remote:        In Gemfile:
remote:        sqlite3
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected sqlite3 gem which is not supported on Heroku:
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to murmuring-river-60914.
remote: 
To https://git.heroku.com/murmuring-river-60914.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/murmuring-river-60914.git'

I have followed the tutorial instruction by setting the Gemfile with this inside:我通过在里面设置 Gemfile 来遵循教程说明:

group :development, :test do
  gem 'sqlite3', '1.3.13'
  gem 'byebug',  '9.0.0', platform: :mri
end

group :production do
  gem 'pg', '0.20.0'
end

For multiple buildpacks, remove all of them and then set the Ruby one:对于多个构建包,删除所有构建包,然后将 Ruby 设置为一个:

$ heroku buildpacks:clear
$ heroku buildpacks:set heroku/ruby

About SQLite on Heroku :关于Heroku 上的 SQLite

SQLite runs in memory, and backs up its data store in files on disk. SQLite 在内存中运行,并在磁盘上的文件中备份其数据存储。 While this strategy works well for development, Heroku's Cedar stack has an ephemeral filesystem.虽然这种策略适用于开发,但 Heroku 的 Cedar 堆栈有一个临时文件系统。 You can write to it, and you can read from it, but the contents will be cleared periodically.您可以写入它,也可以从中读取,但内容将被定期清除。 If you were to use SQLite on Heroku, you would lose your entire database at least once every 24 hours.如果您要在 Heroku 上使用 SQLite,您将至少每 24 小时丢失一次整个数据库。

So, for the message所以,对于消息

sqlite3.h is missing.缺少 sqlite3.h。 Try 'brew install sqlite3'`尝试'brew install sqlite3'`

replace the sqlite3 gem for pg in your Gemfile, then edit the database.yml file:在 Gemfile 中将sqlite3 gem 替换为pg ,然后编辑 database.yml 文件:

# Gemfile
gem 'pg'

# config/database.yml
default: &default
  adapter: postgresql
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: your_project_name_dev

test:
  <<: *default
  database: your_project_name_test

production:
  <<: *default
  database: your_project_name_prod

Probably you'll need to clean the tmp/ folder, so you can delete the Gemfile.lock file and run the rails commands for that:可能您需要清理 tmp/ 文件夹,以便您可以删除 Gemfile.lock 文件并为此运行 rails 命令:

$ rm -rf Gemfile.lock
$ rails tmp:clear
$ rails tmp:create

暂无
暂无

声明:本站的技术帖子网页,遵循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 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) 安装 sqlite3 (1.3.7) 时出错,Bundler 无法继续无法创建 rails 应用程序 - An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue Cannot create rails app RoR Michael Hartl Tutorial (3rd) - 安装 sqlite3 时出错,Bundler 无法继续 - RoR Michael Hartl Tutorial (3rd) - An error occurred while installing sqlite3, and Bundler cannot continue 安装json(1.8.1)时发生错误,Bundler无法继续 - Rails - An error occurred while installing json (1.8.1), and Bundler cannot continue - Rails Rails中的“安装json(1.8.0)时发生错误,并且Bundler无法继续” - “An error occurred while installing json (1.8.0), and Bundler cannot continue” in Rails 安装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
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM