yuuki0205nano
@yuuki0205nano (よしおか)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Herokuでのデプロイでエラーを直したい

解決したいこと

laravelで作成したポートフォリオをHerokuでデプロイしたいのですがエラーが出てしまい進めません
ご教授お願い致します。

発生している問題・エラー

heroku login
heroku git:remote -a azoonapplication
git push heroku master //ここでエラーが出てしまいました

>git push heroku master

Enumerating objects: 219, done.
Counting objects: 100% (219/219), done.
Delta compression using up to 4 threads
Compressing objects: 100% (200/200), done.
Writing objects: 100% (219/219), 1.46 MiB | 689.00 KiB/s, done.
Total 219 (delta 42), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. heroku/nodejs
remote:        2. heroku/php
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 14.x...
remote:        Downloading and installing node 14.18.3...
remote:        Using default npm version: 6.14.15
remote:
remote: -----> Installing dependencies
remote:        Installing node modules
remote:        npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
remote:        npm ERR!
remote:        npm ERR!
remote:        npm ERR! Invalid: lock file's resolve-url-loader@4.0.0 does not satisfy resolve-url-loader@^2.3.1
remote:        npm ERR!
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.OMai5/_logs/2022-01-27T05_48_45_058Z-debug.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:        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: 23d512e3463e3b3edb81e3dce44564a5008103e4
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 23d512e3463e3b3edb81e3dce44564a5008103e4
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 azoonapplication.
remote:
To https://git.heroku.com/azoonapplication.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/azoonapplication.git'

補足

参考サイト
https://ayaka-weblog.com/programming/laravel/laravel-heroku/

package.json

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress  --config=node_modules/laravel-mix/setup/webpack.config.js"
        ,"heroku-postbuild": "npm run prod" //この部分を変更しました
    },
    "devDependencies": {
        "axios": "^0.24.0",
        "bootstrap": "^4.0.0",
        "cross-env": "^5.1",
        "jquery": "^3.2",
        "laravel-mix": "^6.0.39",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.20.1",
        "sass-loader": "^8.0.0",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10"
    }
}

自分で試したこと

nmpとnodeがインストールできていないのかと思い、確認しました

>node -v 
v14.18.0

>nmp -v 
6.14.15

アプリ直下にProcfileを作成して、
web: vendor/bin/heroku-php-apache2 public/

package-look.jsonがないかと確認したらしっかり存在します。。。

0

No Answers yet.

Your answer might help someone💌