部署 明明已经执行了 bundle install ,但是推 heroku 的时候还是报错 sqlite1.3.8 error

inocr · 2014年02月15日 · 最后由 zj0713001 回复于 2014年02月23日 · 3645 次阅读
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.3.8'` 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

以下是我 gemfile 里面的信息

group :development do
  gem 'sqlite3', '1.3.8'
end

不要把他放到 development 的 group 里~

如果是 Heroku 的话,本地最好用 pg 替代 sqlite,数据库使用 Postgresql

#1 楼 @zj0713001 我在学习一本教材《Ruby on Rails Tutorial》里面,提到要这么做,下面是详细的 gemfile

source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.2'

group :development do
  gem 'sqlite3', '1.3.8'
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.15.1'
  gem 'rails_12factor', '0.0.2'
end
4 楼 已删除

真不好意思!这几天忙,现在才回复你们。

#5 楼 @inocr 但是你要是在产品模式使用 sqlite3 的话 就要放到 production 的 group 里

#2 楼 @chunlea 我是已经在 gemfile 里添加 pg 到 production 的

heroku 按理说应该不会去安装 development 里面的 gem 的。奇怪。去掉 development 里面的 sqlite 再上传一次试试。

#8 楼 @alsotang @zj0713001 我去试试,预感还是不行,就如@alsotang说的,安装 development 里面的东西了。

#9 楼 @inocr 或者你的 database.yml 里 还存在 adapter: sqlite3

既然要用到 Heroku,那么为什么不在本地也用一样的数据库呢?虽然 ActiveRecord 很大层面上屏蔽了数据库之间的差异,但是我真心觉得你一定会在某个时候会写一点数据库特定的代码,与其这样,为什么本地开发环境不跟远程环境一致呢?

#10 楼 @zj0713001 的确是这样!不过这个不影响吧?

      Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Bundle completed (18.44s)
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
       Detected manifest file, assuming assets were compiled locally
-----> Discovering process types
       Procfile declares types -> (none)
       Default types for Ruby  -> console, rake, web, worker

-----> Compressing... done, 21.1MB
-----> Launching... done, v6
       http://rocky-fortress-5190.herokuapp.com deployed to Heroku

To [email protected]:rocky-fortress-5190.git
 * [new branch]      master -> master

今天在另一台电脑重新搭建了配置了下,竟然直接成功了,不需要改 database.yml

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# 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:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

#12 楼 @inocr 唉 其实应该是不影响的 可能是吧... 前几天你人品不好...

需要 登录 后方可回复, 如果你还没有账号请 注册新账号