Heroku节点应用程序意外挂起,验证部署

时间:2017-01-23 13:38:53

标签: node.js git heroku deployment

节点应用程序在本地工作正常,但在我执行git推送时显示永不停止验证部署?

它发生了三次,没有成功或错误消息

Counting objects: 34, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (32/32), done.
Writing objects: 100% (34/34), 3.04 KiB | 0 bytes/s, done.
Total 34 (delta 24), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote: 
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_ENV=staging
remote:        NODE_MODULES_CACHE=true
remote:        
remote:        npm scripts will see NODE_ENV=production (not 'staging')
remote:        https://docs.npmjs.com/misc/config#production
remote: 
remote: -----> Installing binaries
remote:        engines.node (package.json):  >=0.10.0
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version >=0.10.0 via semver.io...
remote:        Downloading and installing node 6.9.1...
remote:        Using default npm version: 3.10.8
remote: 
remote: -----> Restoring cache
remote:        Loading 2 from cacheDirectories (default):
remote:        - node_modules
remote:        - bower_components (not cached - skipping)
remote: 
remote: -----> Building dependencies
remote:        Installing node modules (package.json)
remote: Verifying deploy......................................................................................................................................

错误日志:

2017-01-23T12:33:34.342474+00:00 app[web.1]: 
2017-01-23T12:33:34.353035+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2017-01-23T12:33:34.343427+00:00 app[web.1]: npm ERR! missing script: start
2017-01-23T12:33:34.431311+00:00 heroku[web.1]: Process exited with status 1
2017-01-23T12:33:34.433894+00:00 heroku[web.1]: State changed from starting to crashed
2017-01-23T13:42:29.700426+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=angular-frontend-stage.herokuapp.com request_id=44ab1149-b2db-436b-b646-f3781dd9df05 fwd="171.61.99.93" dyno= connect= service= status=503 bytes=
2017-01-23T13:42:31.276860+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=angular-frontend-stage.herokuapp.com request_id=070bb388-7a7b-409a-be6c-f7759c1c9ecc fwd="171.61.99.93" dyno= connect= service= status=503 bytes=
2017-01-23T13:43:24.665641+00:00 heroku[slug-compiler]: Slug compilation started
2017-01-23T13:43:24.665662+00:00 heroku[slug-compiler]: Slug compilation timed out: 3600.422883083 seconds.

1 个答案:

答案 0 :(得分:0)

正如您在错误日志中看到的那样

2017-01-23T12:33:34.343427+00:00 app[web.1]: npm ERR! missing script: start

您的package.json文件未声明任何start命令。

  

要确定如何启动您的应用,Heroku首先会查找Procfile。   如果Node.js应用程序不存在Procfile,我们将尝试启动   通过package.json中的启动脚本进行默认Web进程。   Web进程类型中的命令必须绑定到端口号   在PORT环境变量中指定。如果没有,那就是dyno   不会开始。

你应该指定它,以便让Heroku能够启动你的应用程序:

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

更新#1:

尝试移除Procfile,然后移至package.json

"scripts": {
  "start": "node server/app.js",
  "postinstall": "bower install && ./bin/www staging"
}

Heroku将运行npm install,执行postinstall命令中的bower install

此外,您可以阅读"Heroku: Customizing The Build Process"