1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

メモ:herokuでrailsを動かそうとした時のエラー対応

Posted at

開発環境

  • macOS 10.13.3
  • ruby 2.3.3

railsをローカルで動かそうとした場合

$ bundle install

An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.

以下を実行しても効果なし

$ brew install sqlite3
$ bundle install --path vendor/bundle

brewでインストールするsqlite3のバージョンが高すぎるようなので、一旦brewからは削除

$ brew uninstal sqlite3 

何度かエラーが出るがメッセージにあるコマンドを打てばいずれ削除出来る
削除が終わった後、gemからsqlite3をインストール

$ sudo gem install sqlite3 -v "1.3.13"

bundle installする前に、オプションを設定して実行

$ sudo ARCHFLAGS="-arch x86_64" bundle install --path vendor/bundle

以上でエラーが出ずに通るようになった

herokuでrailsを動かそうとした時

herokuではrailsはpostgresqlで動かす必要があるのでGemfileでpgを追加しておくが、うまく動かない場合

$ brew install postgresql

/usr/local/Cellar/postgresql/XX.X(バージョン)/bin/pg_configの存在を確認

$ bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/XX.X/bin/pg_config
$ ARCHFLAGS="-arch x86_64" bundle install --path vendor/bundle

herokuでApplicationErrorが起きている場合、gemで入れるpostgresqlのバージョンを変更する
1.0.0 → 0.2

以上で正常に動作する事確認

参考サイト

Webサービスをすぐに動かせる!HerokuでRailsアプリを公開する方法【初心者向け】
【Rails】Heroku上でApplication Error(H10 App crashed)【PostgreSQL】
Error with sqlite3 when running bundle install

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?