我对这个问题感到很疯狂。
我是Heroku的新手,今天我正在尝试部署我的应用程序,但我无法。我可以构建一次,但它给了我一个“内部服务器错误”。
当我运行git push heroku master
时,在提交之后,它返回:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
###### WARNING:
Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
In rare occasions Bundler may not be able to resolve your dependencies at all.
https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using 1.7.12
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using json 1.8.2
Using i18n 0.7.0
...
Using sass-rails 5.0.3
Using turbolinks 2.5.3
Installing bootstrap-sass 3.2.0.2
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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=/tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/ruby-2.0.0/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/
Gem files will remain installed in /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
Results logged to /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
Bundler Output: Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using json 1.8.2
Using i18n 0.7.0
...
Using sass-rails 5.0.3
Using turbolinks 2.5.3
Installing bootstrap-sass 3.2.0.2
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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=/tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/ruby-2.0.0/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/
Gem files will remain installed in /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
Results logged to /tmp/build_4e3945a34652ba20ca13b13d160a9dd7/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby app
如果这是一个简单的错误,请原谅我。但它让我头疼。
答案 0 :(得分:4)
错误:我不知道我必须做出改变。
这就是全部。谢谢,@苏斯洛夫
答案 1 :(得分:1)
如您的错误代码中所述,Heroku不支持sqlite3
gem:
检测到Heroku不支持的sqlite3 gem。
因此您无法使用SQLite数据库,应该从Gemfile
这一行中删除:
gem 'sqlite3'
Instead Heroku supports pg
gem to run your application on PostgreSQL RDBMS所以您应该将以下行添加到Gemfile
:
gem 'pg'
然后运行bundle install
。
在config/database.yml
更改您的RDBMS设置:
default: &default
adapter: postgresql
pool: 5
timeout: 5000
development:
database: db/development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test
production:
<<: *default
database: db/production
之后,您应该commit
所有更改并最终运行:
git push heroku master
答案 2 :(得分:0)
您是否尝试从本地存储库推送到托管?在你推之前我认为你必须通过输入来建立关系。
$ git remote add [alias] [url]
如果您使用git clone获取存储库,则键入$git push heroku master
并再次键入$ git push
而不使用heroku master。我希望这能回答你的问题。
答案 3 :(得分:0)
我可以帮助你:
group :production do
gem 'pg'
end