“sqlite3.h” missing when pushing Rails app to Heroku

后端 未结 5 1213
有刺的猬
有刺的猬 2020-12-24 14:38

I\'m following this tutorial, but it fails when I try to push to Heroku. It seems \"sqlite3.h\" is missing. I\'m new to development so I\'m not sure what information will

相关标签:
5条回答
  • 2020-12-24 14:40

    Heroku uses postgresql so you want to remove sqlite3 or move it into a development group in your Gemfile.

    Check you Gemfile.lock for any other gems that may have dependencies on sqlite3, as this can also cause problems.

    0 讨论(0)
  • 2020-12-24 14:46
    gem 'sqlite3', :group => [:development, :test]
    group :production do
      gem 'pg'
    end
    
    1. edit Gemfile as above
    2. remove Gemfile.lock
    3. run bundle install --without production
    4. git add .
    5. git commit -am "bundle updating sqlite3"
    6. git push heroku master
    0 讨论(0)
  • 2020-12-24 14:52

    What happened to me was, I was following along the Heroku tutorial and when I used git push heroku master it was pushing from my latest Git commit (obviously!)

    What I forgot was that in the eyes of Git, I was still using sqlite in the gemfile! Silly me!

    So I used git add . followed by a git commit -m "Changed to Postgres." so Git knew about these changes. Pushing after that worked fine for me.

    0 讨论(0)
  • 2020-12-24 14:52

    Yes, as these answers suggest, most of the time you will want to avoid using SQLite in production due to the constraints of the Heroku platform. However, you may have a perfectly acceptable use case (ex. read-only config) for using SQLite anyway. My recommendation is to:

    1. Add the heroku-buildpack-apt buildpack

    2. Add to your Aptfile:

      libsqlite3-dev
      libsqlite3-0
      
    0 讨论(0)
  • 2020-12-24 14:55

    I had a similar problem and I wasn't even using sqlite3 for anything but after removing it from the gem file I still got that error

    what solved it for me was a commit command

    git commit -am 
    

    that I found on this tutorial

    0 讨论(0)
提交回复
热议问题