#実現したいこと
Herokuへのデプロイが成功したので、heroku run rails db:migrate
してアプリが見れる状態にしたい(ログは heroku logs --tailで確認しました)
#環境
- Rails:5.2.4
- DB:Postgres
#試したこと
buildpackを実装して、無事にgit push heroku master
して
すると、remote rejectedの状態がなくなり、無事に$ git push heroku master
して、デプロイに成功しました。
成功した時のコード
remote: Verifying deploy... done. To https://git.heroku.com/test-ttmanager.git * [new branch] master -> master
しかし、いざ、run heroku db:migrateすると、下記に示すエラー内容が出てしまいました。こちらの原因と、どうしたら解消できるか、調査中ですが、おわかりの方がいらっしゃれば、ご教示いただけないでしょうか?何卒よろしくお願い致します。
#エラー内容
terminal
1user$ heroku run rails db:migrate 2Running rails db:migrate on ⬢ test-ttmanager... up, run.3315 (Free) 3Usage: 4 rails new APP_PATH [options] 5 6Options: 7 [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications) 8 -r, [--ruby=PATH] # Path to the Ruby binary of your choice 9 # Default: /app/vendor/ruby-2.6.5/bin/ruby 10 -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL) 11 -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc) 12 # Default: sqlite3 13 [--skip-yarn], [--no-skip-yarn] # Don't use Yarn for managing JavaScript dependencies 14 [--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile 15 -G, [--skip-git], [--no-skip-git] # Skip .gitignore file 16 [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files 17 -M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files 18 -O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files 19 [--skip-active-storage], [--no-skip-active-storage] # Skip Active Storage files 20 -P, [--skip-puma], [--no-skip-puma] # Skip Puma related files 21 -C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files 22 -S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files 23 [--skip-spring], [--no-skip-spring] # Don't install Spring application preloader 24 [--skip-listen], [--no-skip-listen] # Don't generate configuration that depends on the listen gem 25 [--skip-coffee], [--no-skip-coffee] # Don't use CoffeeScript 26 -J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files 27 [--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem 28 -T, [--skip-test], [--no-skip-test] # Skip test files 29 [--skip-system-test], [--no-skip-system-test] # Skip system test files 30 [--skip-bootsnap], [--no-skip-bootsnap] # Skip bootsnap gem 31 [--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout 32 [--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository 33 [--rc=RC] # Path to file containing extra configuration options for rails command 34 [--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file 35 [--api], [--no-api] # Preconfigure smaller stack for API only apps 36 -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install 37 [--webpack=WEBPACK] # Preconfigure for app-like JavaScript with Webpack (options: react/vue/angular/elm/stimulus) 38 39Runtime options: 40 -f, [--force] # Overwrite files that already exist 41 -p, [--pretend], [--no-pretend] # Run but do not make any changes 42 -q, [--quiet], [--no-quiet] # Suppress status output 43 -s, [--skip], [--no-skip] # Skip files that already exist 44 45Rails options: 46 -h, [--help], [--no-help] # Show this help message and quit 47 -v, [--version], [--no-version] # Show Rails version number and quit 48 49Description: 50 The 'rails new' command creates a new Rails application with a default 51 directory structure and configuration at the path you specify. 52 53 You can specify extra command-line arguments to be used every time 54 'rails new' runs in the .railsrc configuration file in your home directory. 55 56 Note that the arguments specified in the .railsrc file don't affect the 57 defaults values shown above in this help message. 58 59Example: 60 rails new ~/Code/Ruby/weblog 61 62 This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
log
12020-06-22T13:31:49.000000+00:00 app[api]: Build started by user ※※*@※※*.com 22020-06-22T13:35:47.312574+00:00 app[api]: Set LANG, RACK_ENV, RAILS_ENV, RAILS_LOG_TO_STDOUT, RAILS_SERVE_STATIC_FILES, SECRET_KEY_BASE config vars by user ※※*@※※*.com 32020-06-22T13:35:47.312574+00:00 app[api]: Release v3 created by user saito.k.13184@gmail.com 42020-06-22T13:35:50.833684+00:00 app[api]: Attach DATABASE (@ref:postgresql-opaque-77523) by user ※※*@※※*.com 52020-06-22T13:35:50.833684+00:00 app[api]: Running release v4 commands by user ※※*@※※*.com 62020-06-22T13:35:50.852147+00:00 app[api]: @ref:postgresql-opaque-77523 completed provisioning, setting DATABASE_URL. by user ※※*@※※*.com 72020-06-22T13:35:50.852147+00:00 app[api]: Release v5 created by user ※※*@※※*.com 82020-06-22T13:35:51.213419+00:00 app[api]: Release v6 created by user ※※*@※※*.com 92020-06-22T13:35:51.213419+00:00 app[api]: Deploy 2e260b4a by user ※※*@※※*.com 102020-06-22T13:35:51.231802+00:00 app[api]: Scaled to console@0:Free rake@0:Free web@1:Free by user ※※*@※※*.com 112020-06-22T13:35:57.345087+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production` 122020-06-22T13:35:58.000000+00:00 app[api]: Build succeeded 132020-06-22T13:36:00.307868+00:00 app[web.1]: bash: bin/rails: No such file or directory 142020-06-22T13:36:00.405471+00:00 heroku[web.1]: Process exited with status 127 152020-06-22T13:36:00.462719+00:00 heroku[web.1]: State changed from starting to crashed 162020-06-22T13:36:00.464965+00:00 heroku[web.1]: State changed from crashed to starting 172020-06-22T13:36:06.747661+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production` 182020-06-22T13:36:10.116015+00:00 app[web.1]: bash: bin/rails: No such file or directory 192020-06-22T13:36:10.201753+00:00 heroku[web.1]: Process exited with status 127 202020-06-22T13:36:10.265126+00:00 heroku[web.1]: State changed from starting to crashed 212020-06-22T13:38:41.197685+00:00 app[api]: Starting process with command `rails db:migrate` by user ※※*@※※*.com 222020-06-22T13:38:45.443569+00:00 heroku[run.3315]: State changed from starting to up 232020-06-22T13:38:45.503484+00:00 heroku[run.3315]: Awaiting client 242020-06-22T13:38:45.528062+00:00 heroku[run.3315]: Starting process with command `rails db:migrate` 252020-06-22T13:38:49.972027+00:00 heroku[run.3315]: Process exited with status 0 262020-06-22T13:38:50.000563+00:00 heroku[run.3315]: State changed from up to complete 272020-06-22T13:44:37.381050+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test-ttmanager.herokuapp.com request_id=※※※*-※※※* fwd="103.5.140.170" dyno= connect= service= status=503 bytes= protocol=https 282020-06-22T13:44:37.729897+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test-ttmanager.herokuapp.com request_id=01fffd4e-ec3d-478f-84a3-add40e566298 fwd="※*.※*.※*.170" dyno= connect= service= status=※* bytes= protocol=https
#追記 回答を受けて、試したこと
deployしたdirにcdしていないようにみえます。
Gemfilや app, config, public, db などのあるdirにcdする操作をその前に行ってください
とあったので、ルートディレクトリから対象のdirに移動して色々試しましたが、結果うまくいきませんでした。何がいけなかったのか?どうしたらいいのか、ご教示頂けますと幸いです。
①対象dirに移動
②念のためheroku apps
で確認したが、ちゃんと入っている
== **@**.com Apps App 1 App 2 App 3
③移動したdirに、リモートリポジトリ が存在するか確認
***:***(アプリ名) user$ git remote -v heroku https://git.heroku.com/(アプリ名).git (fetch) heroku https://git.heroku.com/(アプリ名).git (push)
④公式ガイドを元に、再度デプロイし、heroku run db:migrate
するが、失敗。
****:(アプリ名) user$ heroku login heroku: Press any key to open up the browser to login or q to exit: Opening browser to https://cli-auth.heroku.com/auth/cli/browser/****-****-****-****-******** Logging in... done Logged in as ****@***.com ****:(アプリ名) user$ heroku git:clone -a (アプリ名) Cloning into '(アプリ名)'... remote: Counting objects: 707, done. remote: Compressing objects: 100% (302/302), done. remote: Total 707 (delta 364), reused 707 (delta 364) Receiving objects: 100% (707/707), 238.07 KiB | 354.00 KiB/s, done. Resolving deltas: 100% (364/364), done. ****:(アプリ名) user$ cd test-ttmanager ****:(アプリ名) user$ git add . ****:(アプリ名) user$ git commit -am "make it better" On branch master Your branch is up to date with 'heroku/master'. nothing to commit, working tree clean ****:(アプリ名) user$ git push heroku master Everything up-to-date ****:(アプリ名) user$ heroku run rails db:migrate Running rails db:migrate on ⬢ test-ttmanager... up, run.7994 (Free) Usage: rails new APP_PATH [options] (以下、質問当初と同じエラー)
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/06/24 01:55