質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Vue.js

Vue.jsは、Webアプリケーションのインターフェースを構築するためのオープンソースJavaScriptフレームワークです。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Q&A

解決済

2回答

2176閲覧

Node.jsのアプリケーションをHerokuで公開したい。

退会済みユーザー

退会済みユーザー

総合スコア0

Vue.js

Vue.jsは、Webアプリケーションのインターフェースを構築するためのオープンソースJavaScriptフレームワークです。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

0グッド

0クリップ

投稿2020/10/16 06:34

編集2020/10/18 13:01

前提・実現したいこと

Vue.jsのアプリケーションでアンケートページを作成しています。
Herokuで公開したいのですが、エラーが発生してしまい、どうすればいいのかわからないため、ご質問させていただきました。
Herokuは今まで使用したことがなく、初心者です・・・。

発生している問題・エラーメッセージ

イメージ説明

ターミナル

$heroku logs 2020-10-16T05:16:26.250396+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=f8757943-4bbb-4bcb-b4f4-04097554cf67 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:16:26.694044+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=a286e16b-c8de-40cb-8dff-4bac060cec0d fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:16:27.306124+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-hollows-34215.herokuapp.com request_id=c33de659-64fc-4884-b7ef-8fb3e7bbcc7a fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:17:55.300171+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=09845468-033e-4bb6-8ec1-56bcbdff0f53 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:17:55.761658+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=e585c9d7-1cbc-4d8e-810c-d668158bf675 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:17:56.302157+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-hollows-34215.herokuapp.com request_id=824e3327-b6de-4f4b-9695-84b85ad505c1 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:22:24.422451+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=38377d9a-6501-4c71-8fe9-bc304d54b765 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:22:24.872156+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=68e429fd-2099-41f0-b92a-5a04fc7fe816 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:22:25.442975+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-hollows-34215.herokuapp.com request_id=17f6c7f7-84d6-4f47-aa85-a9ee9929851f fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https

Heroku Activityログ

-----> Node.js app detected -----> Creating runtime environment NPM_CONFIG_LOGLEVEL=error NODE_ENV=production NODE_MODULES_CACHE=true NODE_VERBOSE=false -----> Installing binaries engines.node (package.json): unspecified engines.npm (package.json): unspecified (use default) Resolving node version 12.x... Downloading and installing node 12.19.0... Using default npm version: 6.14.8 -----> Installing dependencies Installing node modules (package.json) up to date in 0.223s found 0 vulnerabilities -----> Build -----> Caching build - node_modules (nothing to cache) -----> Pruning devDependencies up to date in 0.23s found 0 vulnerabilities -----> Build succeeded! ! This app may not specify any way to start a node process https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type -----> Discovering process types Procfile declares types -> (none) Default types for buildpack -> web -----> Compressing... Done: 22.4M -----> Launching... Released v6 https://intense-hollows-34215.herokuapp.com/ deployed to Heroku

該当のソースコード

package.json

"scripts": { "start": "node dist/index.js", "build": "run-s build:*", "build:backend": "tsc", "build:front": "webpack --config webpack.front.config.js --mode production", "watch": "run-p watch:*", "watch:front": "webpack --config webpack.front.config.js --watch --mode development", "watch:backend": "tsc-watch --onSuccess \"node dist/index.js\"", "test": "echo \"Error: no test specified\" && exit 1" },

src/backend/index.tx

import express from 'express' import messageController from './controllers/message' import enqueteController from './controllers/enquete' import loginController from './controllers/login' import { createConnection } from 'typeorm' import Enquete from './models/Enquete' const app: express.Express = express() app.use(express.json()) app.use(express.urlencoded({ extended: true })) app.use("/messages", messageController) app.use("/api/enquetes", enqueteController) app.use("/api/login", loginController) app.use("/", express.static(__dirname + "/public")) app.get('*', (req, res) => { res.status(200).sendFile(__dirname + "/public/index.html"); }); !async function initialize() { await createConnection({ type: "postgres", url: process.env.DATABASE_URL || "postgres://postgres:postgres@localhost:5432/postgres", synchronize: true, entities: [ Enquete, ], extra: { ssl: (!!process.env.DATABASE_SSL) ? { rejectUnauthorized: false, } : false, } }); const port = process.env.PORT || 3000; app.listen(port, () => { console.log("ポート" + port + "番で起動しました〜!") }) }()

試したこと

「HerokuでNode.jsアプリケーションを公開する」(https://pragmatic.ukiuni.com/type_deploy_heroku/)
この記事を参照して作成していました。

よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

ベストアンサー

git branch で 別のブランチにいたのが原因でした。

$git checkout master $ heroku create $ git push heroku master $ heroku ps:scale web=1 $ heroku open

で無事にデプロイできました。
初歩的すぎるミスでしたが、自己解決できて良かったです・・。
ご協力していただいた方、ありがとうございます!

=> 気づいたきっかけ
Herokuのデプロイチュートリアルを一通りやって、
さらに、こちらの記事(『Node.jsでのHerokuチュートリアル前編』)を参照していました。

その中で、

$ git push heroku main

の「main」部分を「master」で誤ってコマンド実行してしまったら、似たようなエラーが発生したので、
もしや・・と思いブランチを確認したところ、ブランチが違いました。

投稿2020/10/19 12:10

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

類似の質問や記事がいくつかありましたので、ご参考にどうぞ。
http://qiita.com/kents1002/items/e1b90c71897c55b8e870

http://teratail.com/questions/142353

投稿2020/10/16 06:45

firegrape

総合スコア902

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2020/10/16 07:24

ありがとうございます!参考にさせていただきます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問