heroku中的dm-postgres-adapter加载错误

问题描述 投票:0回答:1

我在Heroku中部署了一个Sinatra应用程序。由于dm-postgres-adapter加载错误,我无法迁移postgres数据库(见下文)。知道如何解决这个问题吗?

irb(main):001:0> require './app'
LoadError: cannot load such file -- dm-postgres-adapter
    from /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `require'
    from /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `load_adapter'
    from /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:133:in `adapter_class'
    from /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:13:in `new'
    from /app/vendor/bundle/ruby/2.2.0/gems/dm-core-1.2.1/lib/dm-core.rb:230:in `setup'
    from /app/app.rb:14:in `block in <top (required)>'
    from /app/vendor/bundle/ruby/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1411:in `configure'
    from /app/vendor/bundle/ruby/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1981:in `block (2 levels) in delegate'
    from /app/app.rb:13:in `<top (required)>'
    from (irb):1:in `require'
    from (irb):1

我的Gemfile:

gem 'dm-postgres-adapter', :group => :production
gem 'dm-sqlite-adapter', :group => :development

我的应用主文件中的数据库配置(app.rb)

configure :development do
  DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/development.db")
end

configure :production do
  DataMapper.setup(:default, ENV['DATABASE_URL'])
end
ruby postgresql heroku sinatra
1个回答
0
投票

万一其他人偶然发现:

您需要从工作树中删除.bundle /文件夹,并将.bundle /添加到.gitignore文件中。

git add / commit / push,然后heroku push将解决问题

© www.soinside.com 2019 - 2024. All rights reserved.