実現したいこと
Laravelで作成したプロジェクトをHerokuにアップしたいのですが、Node.js及びnpmについてのエラーが発生します。
ログ等の詳細が下記に記載させて頂きます。
簡潔にはpackage.jsonの記述及びnode.jsとnpmのバージョンが古いのが原因の可能性を調べているのですが、ログを見て頂くことは可能でしょうか?
前提
package.jsonには"heroku-postbuild": "npm run prod"
を追記しています。
発生している問題・エラーメッセージ
remote: npm ERR! Missing script: "prod" remote: npm ERR! remote: npm ERR! To see a list of scripts, run: remote: npm ERR! npm run remote: remote: npm ERR! A complete log of this run can be found in: /tmp/npmcache.Nnp2B/_logs/2023-11-16T13_12_31_728Z-debug-0.log 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: If you're stuck, please submit a ticket so we can help: remote: https://help.heroku.com/ 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: b3ce18d4eff328f88f1866bcba42ab1efe677368 remote: ! remote: ! We have detected that you have triggered a build from source code with version b3ce18d4eff328f88f1866bcba42ab1efe677368 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 ****. remote: To https://git.heroku.com/****.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/****.git'
該当のソースコード
package.json
1{ 2 "private": true, 3 "type": "module", 4 "scripts": { 5 "dev": "vite", 6 "build": "vite build", 7 "heroku-postbuild": "npm run prod" 8 }, 9 "devDependencies": { 10 "@popperjs/core": "^2.11.6", 11 "@vitejs/plugin-vue": "^4.0.0", 12 "axios": "^1.1.2", 13 "bootstrap": "^5.2.3", 14 "laravel-vite-plugin": "^0.8.0", 15 "sass": "^1.56.1", 16 "vite": "^4.0.0", 17 "vue": "^3.2.37" 18 } 19}
試したこと
herokuのサポートサイトを確認したところ、node及びnpmのバージョンの差異的なものがnpmがビルドできない理由かなと考えたのですが、他のherokuにプッシュ出来たプロジェクトのバージョンを確認したところ、差異があってもプッシュ出来ていたので、Laravelのバージョンによってherokuへのプッシュの行い方が少々、異なるのかと思ったのですが、どうでしょうか?
ちなみにプッシュが成功したLaravelプロジェクトのバージョンは8でした。
参考サイト
Laravelをherokuにデプロイする方法・手順の解説(MySQL使用)〜コマンドを使わず、Herokuのサイト上で設定するよ!〜
補足情報(FW/ツールのバージョンなど)
PHP8
Laravel10
npm 9.8.1
node v16.20.2
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2023/11/18 05:33
2023/11/18 05:38
2023/11/18 08:22 編集
2023/11/18 08:24
2023/11/18 08:27
2023/11/18 08:34
2023/11/19 03:01
2023/11/19 03:10
2023/11/19 06:41