0

I uploaded my laravel project on webhosting heroku but it doesn´t work, it says: Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail When i run the command heroku logs --tail in cmd it shows:

It looks like there are even more errors than one and I don´t really know what that errors mean and I couldn´t find them anywhere.

2023-02-10T20:33:34.785966+00:00 heroku[web.1]: State changed from starting to crashed
2023-02-10T20:34:07.000000+00:00 app[api]: Build succeeded
2023-02-10T20:34:07.404549+00:00 heroku[web.1]: State changed from crashed to starting
2023-02-10T20:34:10.304458+00:00 heroku[web.1]: Starting process with command `npm start`
2023-02-10T20:34:12.223124+00:00 app[web.1]:
2023-02-10T20:34:12.223146+00:00 app[web.1]: > start
2023-02-10T20:34:12.223147+00:00 app[web.1]: > if-env NODE_ENV=production && npm run start:prod || npm run start:dev
2023-02-10T20:34:12.223147+00:00 app[web.1]:
2023-02-10T20:34:12.228492+00:00 app[web.1]: sh: 1: if-env: not found
2023-02-10T20:34:12.626616+00:00 app[web.1]:
2023-02-10T20:34:12.626644+00:00 app[web.1]: > start:dev
2023-02-10T20:34:12.626646+00:00 app[web.1]: > concurrently "nodemon - -ignore 'client/*'" "npm run client"
2023-02-10T20:34:12.626646+00:00 app[web.1]:
2023-02-10T20:34:12.632186+00:00 app[web.1]: sh: 1: concurrently: not found
2023-02-10T20:34:12.794122+00:00 heroku[web.1]: Process exited with status 127
2023-02-10T20:34:12.856093+00:00 heroku[web.1]: State changed from starting to crashed
2023-02-10T20:34:14.498753+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=poradej-turnaj.herokuapp.com request_id=dbc569cd-b37e-4a45-a8cb-8e791fa59c1c fwd="84.42.219.107" dyno= connect= service= status=503 bytes= protocol=https
2023-02-10T20:34:14.675679+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=poradej-turnaj.herokuapp.com request_id=5476f6cb-67c8-4f2e-a5e2-abdbfc923cc2 fwd="84.42.219.107" dyno= connect= service= status=503 bytes= protocol=https

Here I post some of my code: package.json

{
    "private": true,
    "scripts": {    
        "start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev", 
        "start:prod": "node server.js", 
        "start:dev": "concurrently \"nodemon - -ignore 'client/*'\" \"npm run client\""
    },
    "devDependencies": {
        "@popperjs/core": "^2.11.6",
        "axios": "^0.27",
        "bootstrap": "^5.2.3",
        "laravel-vite-plugin": "^0.6.0",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "sass": "^1.56.1",
        "vite": "^3.0.0"
    },
    "engines": {
        "npm": "9.4.2",
        "node": "18.13.0"
    },
    "dependencies": {
        "nodemon": "^2.0.20"
    }
}

Procfile

web: vendor/bin/heroku-php-apache2 public/

Can you please give me any advice? Tell me if I should post any more code

1 Answer 1

0

It looks like there are two command line utilities that just simply don't exist. if-env and concurrently. If you look at the scripts in your package.json you'll see what I mean. The server is trying to run those commands but the utilities don't exits.

So you'll need to install them on the Heroku server, or find a way to change the way your frontend application is starting.

https://www.npmjs.com/package/if-env

https://www.npmjs.com/package/concurrently

I'm not really sure why your server would be running those scripts though. Usually servers pull the code down from Github, run npm build (or whatever) and then just simply serve the compiled js.

I don't know anything about Heroku though.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your advice, I installed both stuff but after that new error came up: 2023-02-10T22:23:06.195556+00:00 app[web.1]: bash: line 1: vendor/bin/heroku-php-apache2: No such file or directory 2023-02-10T22:23:06.377955+00:00 heroku[web.1]: Process exited with status 127 2023-02-10T22:23:06.499896+00:00 heroku[web.1]: State changed from starting to crashed
Need to install heroku-php-apache2 with composer. Or perhaps just run composer install . This should help stackoverflow.com/a/46023013/3693312

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.