Q&A
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で指定バージョンでデプロイされるでしょうか?
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。