Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
576 views
in Technique[技术] by (71.8m points)

git - Why do I obtain this error when deploying app to Heroku?

I am getting some kind of error when deploying my app to heroku using git hub. The problem is, I don't understand the heroku logs and the entailing errors. Here is the heroku log:

Marcuss-MacBook-Pro:Weather-App marcushurney$ heroku logs
2016-01-05T14:37:27.798077+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-01-05T14:37:27.798377+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-01-05T14:37:27.786949+00:00 app[web.1]: npm ERR! node v5.1.1
2016-01-05T14:37:27.786556+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-01-05T14:37:27.787856+00:00 app[web.1]: npm ERR! npm  v3.3.12
2016-01-05T14:37:28.776245+00:00 heroku[web.1]: Process exited with status 1
2016-01-05T14:37:28.789412+00:00 heroku[web.1]: State changed from starting to crashed
2016-01-05T17:27:16.684869+00:00 heroku[web.1]: State changed from crashed to starting
2016-01-05T17:27:17.853743+00:00 heroku[web.1]: Starting process with command `npm start`
2016-01-05T17:27:20.423495+00:00 app[web.1]: npm ERR! node v5.1.1
2016-01-05T17:27:20.423130+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-01-05T17:27:20.424111+00:00 app[web.1]: npm ERR! npm  v3.3.12
2016-01-05T17:27:20.425937+00:00 app[web.1]: npm ERR! missing script: start
2016-01-05T17:27:20.422441+00:00 app[web.1]: npm ERR! Linux 3.13.0-71-generic
2016-01-05T17:27:20.426242+00:00 app[web.1]: npm ERR! 
2016-01-05T17:27:20.426432+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-01-05T17:27:20.426634+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have to inform heroku where to start : missing script: start. In your package.json, you should have something like this:

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

Where index.js is your entry point.

As an alternative, you can specify in Procfile:

web: node index.js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...