Home>

The ultimate goal is to deploy,

  • How to solve the current error
  • Why is this error occurring?

Want to figure out.

Currently, I can push to heroku from github, but it is displayed on the web page as follows.

Application error
An error occurred in the application and your page could not be served.If i am the application owner, check your logs for details.You can do this from the Heroku CLI with the command

According to this content, I check the log with heroku logs, but it is swept away by the torrent of letters.
At the moment, I don't understand much about the entry points, but I think that I am not able to understand the problem because I cannot solve the problem.

I don't understand where the problem came from, so I will start from the beginning when the problem starts.

First, the log is displayed as follows, and the problem seems to be npm ERR! missing script: start
I think that it is in one sentence, but,

2020-07-19T02:44:42.000000+00:00 app[api]: Build succeeded
2020-07-19T02:44:56.126893+00:00 heroku[web.1]: Starting process with command `npm start`
2020-07-19T02:44:58.985426+00:00 app[web.1]: npm ERR! missing script: start2020-07-19T02:44:59.010559+00:00 app[web.1]:
2020-07-19T02:44:59.011756+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-07-19T02:44:59.012090+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-07-19T02_44_58_986Z-debug.log
2020-07-19T02:44:59.099353+00:00 heroku[web.1]: Process exited with status 1
2020-07-19T02:44:59.143423+00:00 heroku[web.1]: State changed from starting to crashed
2020-07-19T02:45:01.715572+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ucs5.herokuapp.com request_id=5c17f944-d57f -4616-907a-5bb660904efa fwd="182.20.230.97" dyno= connect= service= status=503 bytes= protocol=https
2020-07-19T02:45:02.096137+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ucs5.herokuapp.com request_id= 05f1d2cc-2478-421b-a50e-e72b82af81b0 fwd="182.20.230.97" dyno= connect= service= status=503 bytes= protocol=https

When I check this error, I have the same QandA at the following URL,
https://stackoverflow.com/questions/34631300/error-when-deploying-app-to-heroku

According to this I need to tell Heroku where to start, in package.json:

"scripts": {
  "start": "node index.js"
}


This description is necessary, and it was the content that index.js is the entry point. Therefore, enter the following code

"scripts": {
    "start": "node ./javascript/channels/index.js" // directory where index.js is stored
  }


I ran it with commit ->push ->git push heroku, but I still can't open it, and the log shows something like this:

Error: Cannot find module'/app/javascript/channels/index.js'


I don't know if there's a problem with the way the code is written or with something else.
Even if the deployment itself succeeds, it will not be rendered due to the above error. Although there is a solid file in the part corresponding to this error, it is not recognized by all means.

Understanding (?) about entry points

First of all, I only understand the characters.
Where to start executing the program =>the first program to execute when a server-side request comes in
In this case, the top page is displayed, isn't it?
When the contents set in root are reflected, js is executed first to access the model when reading the view?
The following is described in index.js, suggesting that it is the first file to be read.

// Load all the channels within this directory and all subdirectories.


So I read all the files, soft understanding.

  • Answer # 1

    Although it is different from the above flow, it was solved by putting the source code of Bootstrap itself in the javascript directory and compiling.

  • Answer # 2

    What is worrisome about the error message
    '/app/javascript/channels/index.js'so,
    'app/javascript/channels/index.js'That is not the case.
    Please show the file that specifies index.js

    Also, there is rails6 in TAG, but I am happy that Rails and Ruby versions are also included in the text.