簡體   English   中英

Sails.js應用程序無法在Heroku上部署

[英]Sails.js app fails to deploy on heroku

我的sails.js應用程序在localhost上運行良好,但在heroku上失敗。

我的production.js中有以下設置

  port: process.env.PORT || 1337,
  environment: process.env.NODE_ENV || 'development',

仍然無法獲得消息和部署失敗;

2015-02-10T03:54:55.089482+00:00 app[web.1]: Tue, 10 Feb 2015 03:54:55 GMT i18n:debug read /app/config/locales/de.json for locale: de
2015-02-10T03:54:55.089220+00:00 app[web.1]: Tue, 10 Feb 2015 03:54:55 GMT i18n:debug will write to /app/config/locales/fr.json
2015-02-10T03:54:55.089261+00:00 app[web.1]: Tue, 10 Feb 2015 03:54:55 GMT i18n:debug read /app/config/locales/fr.json for locale: fr
2015-02-10T03:54:55.089453+00:00 app[web.1]: Tue, 10 Feb 2015 03:54:55 GMT i18n:debug will write to /app/config/locales/de.json
2015-02-10T03:54:55.138917+00:00 app[web.1]: designed for a production environment, as it will leak
2015-02-10T03:54:55.138919+00:00 app[web.1]: memory, and will not scale past a single process.
2015-02-10T03:54:55.393772+00:00 app[web.1]: http hook loaded successfully.
2015-02-10T03:54:55.396900+00:00 app[web.1]: sockets hook loaded successfully.
2015-02-10T03:54:55.397665+00:00 app[web.1]: Located 0 user hook(s)...
2015-02-10T03:54:55.413955+00:00 app[web.1]: Setting default Express view engine to jade...
2015-02-10T03:54:55.415525+00:00 app[web.1]: Loading adapter ( sails-mongo ) for user  from `node_modules` directory...
2015-02-10T03:54:55.394180+00:00 app[web.1]: Configuring socket (ws://) server...
2015-02-10T03:54:55.397318+00:00 app[web.1]: Loading user hooks...
2015-02-10T03:54:55.397942+00:00 app[web.1]: views hook loaded successfully.
2015-02-10T03:54:55.414283+00:00 app[web.1]: Initialized 0 user hook(s)...
2015-02-10T03:54:55.414314+00:00 app[web.1]: userhooks hook loaded successfully.
2015-02-10T03:54:55.415058+00:00 app[web.1]: Forcing Waterline to use `migrate: "safe" strategy (since this is production)
2015-02-10T03:54:55.606849+00:00 app[web.1]: Starting ORM...
2015-02-10T03:54:55.771204+00:00 app[web.1]: pubsub hook loaded successfully.
2015-02-10T03:54:55.931003+00:00 app[web.1]: Grunt :: >> Local Npm module "grunt-simple-mocha" not found. Is it installed?
2015-02-10T03:54:55.769438+00:00 app[web.1]: orm hook loaded successfully.
2015-02-10T03:54:56.159039+00:00 app[web.1]: Grunt :: Running "clean:dev" (clean) task
2015-02-10T03:54:56.180324+00:00 app[web.1]: Grunt :: >> Destination not written because compiled files were empty.
2015-02-10T03:54:56.184386+00:00 app[web.1]: Grunt :: Running "copy:dev" (copy) task
2015-02-10T03:54:56.180479+00:00 app[web.1]: Grunt :: Running "less:dev" (less) task
2015-02-10T03:54:56.162834+00:00 app[web.1]: Grunt :: Running "jst:dev" (jst) task
2015-02-10T03:54:56.729594+00:00 app[web.1]: Grunt :: , copied 542 files
2015-02-10T03:54:56.729493+00:00 app[web.1]: Grunt :: Created 4 directories
2015-02-10T03:54:56.730009+00:00 app[web.1]: Grunt :: Running "coffee:dev" (coffee) task
2015-02-10T03:54:56.856265+00:00 app[web.1]: Grunt :: Running "concat:js" (concat) task
2015-02-10T03:54:57.062061+00:00 app[web.1]: Grunt :: File ".tmp/public/concat/production.js" created.
2015-02-10T03:54:57.063749+00:00 app[web.1]: Grunt :: File ".tmp/public/concat/production.css" created.
2015-02-10T03:54:57.064113+00:00 app[web.1]: Grunt :: Running "uglify:dist" (uglify) task
2015-02-10T03:54:57.062590+00:00 app[web.1]: Grunt :: Running "concat:css" (concat) task
2015-02-10T03:55:53.360980+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-02-10T03:55:53.360980+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-02-10T03:55:54.179225+00:00 heroku[web.1]: Process exited with status 137
2015-02-10T03:55:54.193814+00:00 heroku[web.1]: State changed from starting to crashed

請指教,謝謝。

您的應用正在生產模式下運行。 我之所以可以這樣說是因為Forcing Waterline to use `migrate: "safe" strategy (since this is production)並且concat / uglify任務正在運行。

此過程(concat / uglify)可能破壞了分配的內存。 在具有大量要處理的js / css的小型heroku實例上進行部署時,我已經看到了這一點。 您可能想要嘗試https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt在部署而不是啟動時運行grunt。

請參閱http://blog.mdarveau.com/2014/10/20/deploying-to-heroku,以了解我將Sails應用程序部署到heroku的經驗。

日志中的以下部分雖然很奇怪:

2015-02-10T03:54:55.138917+00:00 app[web.1]: designed for a production environment, as it will leak
2015-02-10T03:54:55.138919+00:00 app[web.1]: memory, and will not scale past a single process.

在config / models.js中設置migration:'alter'

快速(臨時)解決方案只是刪除生產標記

delete process.env.NODE_ENV;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM