I'm trying to deploy my frontEnd app in heroku but only what I get is errors.I was fixing error by error, but i do not know what to do with that one.
by the way I'm using vitejs
the error what i get from heroku logs
2021-07-30T11:30:06.680426+00:00 heroku[web.1]: Starting process with command `npm run dev`
2021-07-30T11:30:10.593125+00:00 app[web.1]:
2021-07-30T11:30:10.593146+00:00 app[web.1]: > myapp@1.0.0 dev
2021-07-30T11:30:10.593146+00:00 app[web.1]: > vite
2021-07-30T11:30:10.593146+00:00 app[web.1]:
2021-07-30T11:30:10.614517+00:00 app[web.1]: sh: 1: vite: not found
2021-07-30T11:30:10.686497+00:00 heroku[web.1]: Process exited with status 127
2021-07-30T11:30:10.789749+00:00 heroku[web.1]: State changed from starting to crashed
2021-07-30T11:38:04.881585+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=example.herokuapp.com dyno= connect= service= status=503 bytes= protocol=https
my package.json
{
"name": "myapp",
"description": "a really cool app",
"version": "1.0.0",
"engines": {
"node": "<=16.x.x",
"npm": "<=7.x.x"
},
"scripts": {
"dev": "vite",
"build": "vite build"
},
"dependencies": {
"react": "17.0.0",
"react-dom": "17.0.0",
"styled-components": "5.3.0"
},
"devDependencies": {
"@vitejs/plugin-react-refresh": "1.3.1",
"vite": "2.4.2"
},
"peerDependencies": {
"react-spring": "^9.2.4"
}
}
Found the solution here : https://github.com/vitejs/vite/issues/1215
You have to unset the production mode of npm env or yarn env, as :
heroku config:set NPM_CONFIG_PRODUCTION=false YARN_PRODUCTION=false
or if you use dokku :
dokku config:set my-app NPM_CONFIG_PRODUCTION=false YARN_PRODUCTION=false