next.jsをherokuにデプロイする日本語記事が見当たらなかったため投稿しました。
環境:
node.js
react
next.js
herokuへpushまでは省略します。
push後urlへアクセスすると拒絶されたところから
ログを確認してから出直せと言われたので、
heroku logs -tail
Error: Couldn't find that app.
›
› Error ID: not_found
で、結論から
https://github.com/mars/heroku-nextjs
を参考にしました。
package.json
{"name":"next-yaninavi","version":"1.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\"&& exit 1","dev":"next","build":"next build","start":"next start -p $PORT"},"keywords":[],"author":"","license":"ISC","dependencies":{"next":"^10.0.5","react":"^17.0.1","react-dom":"^17.0.1"}}
npm run build
NODE_EV=production npm run start
heroku触ったことなかったのでビクビクしてたけど、ngrokみたいな感じかな
恐らく、localhostとurlを繋いでるけどそのルート記述が間違ってたのかな。。
理解したら追記します!