I just put my site up on Heroku. Expected result: A live version of my VueJS app, "Twitter Clone". The data got there by syncing my GitHub to Heroku.
Now I have a problem.
https://rolys-twitter-clone.herokuapp.com/ This is my site, not much to see because there's an error message
It reads:
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
So I went into the heroku logs for my app (by typing "heroku logs --tail --app my-app-name" into cmd, for anyone wondering how to check them)... and I found error messages.
The specific error I get is buried in this log data:
2020-01-09T04:17:41.201106+00:00 heroku[web.1]: Starting process with command `npm start`
2020-01-09T04:17:44.040787+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-09T04:17:43.902074+00:00 app[web.1]: npm ERR! missing script: start
2020-01-09T04:17:43.921370+00:00 app[web.1]:
2020-01-09T04:17:43.925728+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-01-09T04:17:43.926046+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-01-09T04_17_43_903Z-debug.log
2020-01-09T04:17:44.002368+00:00 heroku[web.1]: Process exited with status 1
"npm ERR! missing script: start"
Dunno what to do.
Solutions I've tried from various other StackOverflow pages about this error:
1) Adding "scripts": { "start": "node app.js" }
to my package.json's scripts section, reuploading to GitHub, redeploying. Result: "Error: Cannot find module '/app/app.js'"
(No surprise!).
2) Adding "scripts": { "start": "npm run serve" }
to my package.json's scripts section, reup, redeploy. I figure npm run serve
works for the local server, why not try it? Result: "sh: 1: vue-cli-service: not found // npm ERR! code ELIFECYCLE // npm ERR! syscall spawn "
3) Adding "scripts": { "start": "node server.js" }
. Result: Error: Cannot find module '/app/server.js'
Note I've been through about 4 different StackOverflow links about this error, nothing seems relevant (I've even tried a few solutions, as shown above). They're all for other versions of this bug as far as I can tell.
If this page contains a solution, I can't tell how to make it work for my situation. "Where index.js is your entry point"? What's the VueJS equivalent of index.js? My project's root directory only contains: App.vue, db.js, main.js, index.html (under the public folder), and some config files.
Send help! Thanks in advance everyone who reads this.
edit: Following Muljayan's advice I now get:
2020-01-09T06:43:41.857621+00:00 heroku[web.1]: Starting process with command `npm start`
2020-01-09T06:43:44.546969+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-09T06:43:44.413480+00:00 app[web.1]:
2020-01-09T06:43:44.413503+00:00 app[web.1]: > twitter-clone@0.1.0 start /app
2020-01-09T06:43:44.413505+00:00 app[web.1]: > node server.js
2020-01-09T06:43:44.413506+00:00 app[web.1]:
2020-01-09T06:43:44.466287+00:00 app[web.1]: internal/modules/cjs/loader.js:796
2020-01-09T06:43:44.466291+00:00 app[web.1]: throw err;
2020-01-09T06:43:44.466294+00:00 app[web.1]: ^
2020-01-09T06:43:44.466296+00:00 app[web.1]:
2020-01-09T06:43:44.466300+00:00 app[web.1]: Error: Cannot find module '/app/server.js'
2020-01-09T06:43:44.466302+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
2020-01-09T06:43:44.466304+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:686:27)
2020-01-09T06:43:44.466306+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
2020-01-09T06:43:44.466308+00:00 app[web.1]: at internal/main/run_main_module.js:17:11 {
2020-01-09T06:43:44.466311+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',