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

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

新規登録して質問してみよう
ただいま回答率
85.49%
Laravel 6

Laravel 6は、オープンソースなPHPのフレームワーク。Webアプリケーションの開発に適しており、バージョン6はLTSです。5.8での向上に加えて、セマンティックバージョニングの採用やLaravel Vaporとのコンパチビリティなどが変更されています。

Heroku

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

Q&A

解決済

1回答

1070閲覧

LaravelをHerokuにデプロイしたいがBuild failedとなる

tkm0604

総合スコア552

Laravel 6

Laravel 6は、オープンソースなPHPのフレームワーク。Webアプリケーションの開発に適しており、バージョン6はLTSです。5.8での向上に加えて、セマンティックバージョニングの採用やLaravel Vaporとのコンパチビリティなどが変更されています。

Heroku

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

0グッド

0クリップ

投稿2022/04/07 07:11

laravel6 で作成したアプリをherokuへデプロイしたいのですが、git push heroku mainを行うと

error: failed to push some refs to 'https://git.heroku.com/アプリ名.git' 

となってデプロイが完了しません。

ターミナルは以下の様になっています。

remote: -----> Installing binaries remote: engines.node (package.json): unspecified remote: engines.npm (package.json): unspecified (use default) remote: remote: Resolving node version 16.x... remote: Downloading and installing node 16.14.2... remote: Using default npm version: 8.5.0 remote: remote: -----> Installing dependencies remote: Installing node modules remote: remote: added 938 packages, and audited 939 packages in 30s remote: remote: 86 packages are looking for funding remote: run `npm fund` for details remote: remote: 6 vulnerabilities (4 moderate, 1 high, 1 critical) remote: remote: To address issues that do not require attention, run: remote: npm audit fix remote: remote: To address all issues (including breaking changes), run: remote: npm audit fix --force remote: remote: Run `npm audit` for details. remote: remote: -----> Build remote: Running heroku-postbuild remote: remote: > heroku-postbuild remote: > npm run prod remote: remote: remote: > prod remote: > npm run production remote: remote: remote: > production remote: > cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js remote: remote: [webpack-cli] Error: Unknown option '--no-progress' remote: [webpack-cli] Run 'webpack --help' to see available commands and options remote: remote: -----> Build failed remote: remote: We're sorry this build is failing! You can troubleshoot common issues here: remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys remote: remote: Some possible problems: remote: remote: - Node version not specified in package.json remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version remote: remote: Love, remote: Heroku remote: remote: ! Push rejected, failed to compile Node.js app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: c1298c6b96bd27dd49ec908a43f9cb76192ffe1e remote: ! remote: ! We have detected that you have triggered a build from source code with version c1298c6b96bd27dd49ec908a43f9cb76192ffe1e remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to アプリ名.

試したこと

Some possible problems: remote: remote: - Node version not specified in package.json

とあるので、package.jsonに以下を追加しました。

"engines": { "node": "14.x", "npm": "6.x" }

node とnpmに指定したバージョンはローカル開発環境で、node- v(v14.17.1)、npm -v(6.14.13)を実行してターミナルから返って来たバージョンを指定しています。

package.jsonを変更後、再度 git push heroku main を行なったのですが、結果は変わりません。

node.jsとnpmのバージョンを指定したのに

remote: Resolving node version 16.x... remote: Downloading and installing node 16.14.2... remote: Using default npm version: 8.5.0

と、node16.14.2 npm version: 8.5.0をダウンロードしにいっているように見えます。

どうすればpackage.jsonで指定バージョンでデプロイされるでしょうか?

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

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

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

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

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

guest

回答1

0

自己解決

package.jsonの内容がheropkuのリモートリポジトリへ反映されていませんでした。
package.jsonの内容を修正後、npm installを行い(これは必要なかったかも)、
git init
git add .
git commit -m "XXXX"
git push heroku main でエラー解決しました。

投稿2022/04/07 08:06

tkm0604

総合スコア552

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.49%

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

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

質問する

関連した質問