将Yeoman应用程序部署到Heroku的问题

时间:2015-07-24 09:13:07

标签: node.js heroku gruntjs yeoman angular-fullstack

我一直在尝试将我的AngularFullstack(节点)应用程序部署到Heroku。我在终端中创建了应用程序:yo angular-fullstack。每当我尝试部署到Heroku时,当我转到我部署的应用程序时,我会得到以下信息:

  

应用程序错误

     

应用程序中发生错误,您的页面无法执行   提供服务。请稍后再试。

     

如果您是应用程序所有者,请查看日志以获取详细信息。

日志是:

2015-07-24T06:57:35.184227+00:00 heroku[web.1]: State changed from up to starting
2015-07-24T06:57:38.772056+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-07-24T06:57:39.757747+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2015-07-24T06:57:40.645233+00:00 heroku[web.1]: Process exited with status 22
2015-07-24T06:57:49.314501+00:00 heroku[web.1]: Starting process with command `npm start`
2015-07-24T06:57:51.176323+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-07-24T06:57:51.176346+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-07-24T06:57:51.863498+00:00 app[web.1]: > startup@0.0.0 start /app
2015-07-24T06:57:51.863492+00:00 app[web.1]: 
2015-07-24T06:57:51.863500+00:00 app[web.1]: > node server/app.js
2015-07-24T06:57:51.863501+00:00 app[web.1]: 
2015-07-24T06:57:52.919124+00:00 app[web.1]: npm ERR! Linux 3.13.0-57-generic
2015-07-24T06:57:52.926086+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2015-07-24T06:57:52.926206+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2015-07-24T06:57:52.852124+00:00 app[web.1]: fs.js:0
2015-07-24T06:57:52.852131+00:00 app[web.1]: (function (exports, require, module, __filename, __dirname) { // Copyright Joy
2015-07-24T06:57:52.852132+00:00 app[web.1]: 
2015-07-24T06:57:52.852133+00:00 app[web.1]: Error: ENOENT, no such file or directory '/app/public/favicon.ico'
2015-07-24T06:57:52.852135+00:00 app[web.1]:     at Error (native)
2015-07-24T06:57:52.852136+00:00 app[web.1]:     at Object.fs.statSync (fs.js:797:18)
2015-07-24T06:57:52.852137+00:00 app[web.1]:     at favicon (/app/node_modules/serve-favicon/index.js:47:15)
2015-07-24T06:57:52.852139+00:00 app[web.1]:     at module.exports (/app/server/config/express.js:32:13)
2015-07-24T06:57:52.852140+00:00 app[web.1]:     at Object.<anonymous> (/app/server/app.js:35:28)
2015-07-24T06:57:52.852141+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-07-24T06:57:52.852142+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-07-24T06:57:52.852144+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
2015-07-24T06:57:52.852143+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-07-24T06:57:52.852146+00:00 app[web.1]:     at Function.Module.runMain (module.js:501:10)
2015-07-24T06:57:52.893865+00:00 app[web.1]: 
2015-07-24T06:57:52.919677+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-07-24T06:57:52.919919+00:00 app[web.1]: npm ERR! node v0.12.7
2015-07-24T06:57:52.920832+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2015-07-24T06:57:52.920669+00:00 app[web.1]: npm ERR! npm  v2.11.3
2015-07-24T06:57:52.921015+00:00 app[web.1]: npm ERR! startup@0.0.0 start: `node server/app.js`
2015-07-24T06:57:52.921148+00:00 app[web.1]: npm ERR! Exit status 1
2015-07-24T06:57:52.921496+00:00 app[web.1]: npm ERR! Failed at the startup@0.0.0 start script 'node server/app.js'.
2015-07-24T06:57:52.921314+00:00 app[web.1]: npm ERR! 
2015-07-24T06:57:52.921680+00:00 app[web.1]: npm ERR! This is most likely a problem with the startup package,
2015-07-24T06:57:52.922108+00:00 app[web.1]: npm ERR!     node server/app.js
2015-07-24T06:57:52.921833+00:00 app[web.1]: npm ERR! not with npm itself.
2015-07-24T06:57:52.921968+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-07-24T06:57:52.922254+00:00 app[web.1]: npm ERR! You can get their info via:
2015-07-24T06:57:52.922518+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-07-24T06:57:52.922373+00:00 app[web.1]: npm ERR!     npm owner ls startup
2015-07-24T06:57:52.925618+00:00 app[web.1]: 
2015-07-24T06:57:53.972027+00:00 heroku[web.1]: State changed from starting to crashed
2015-07-24T06:57:53.972984+00:00 heroku[web.1]: State changed from crashed to starting
2015-07-24T06:57:53.956209+00:00 heroku[web.1]: Process exited with status 1
2015-07-24T06:58:17.709969+00:00 heroku[web.1]: Starting process with command `npm start`
2015-07-24T06:58:20.882672+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-07-24T06:58:20.898495+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-07-24T06:58:22.481040+00:00 app[web.1]: 
2015-07-24T06:58:22.481045+00:00 app[web.1]: > startup@0.0.0 start /app
2015-07-24T06:58:22.481047+00:00 app[web.1]: > node server/app.js
2015-07-24T06:58:22.481048+00:00 app[web.1]: 
2015-07-24T06:58:23.526831+00:00 app[web.1]: npm ERR! Linux 3.13.0-49-generic
2015-07-24T06:58:23.502777+00:00 app[web.1]: fs.js:0
2015-07-24T06:58:23.502783+00:00 app[web.1]: (function (exports, require, module, __filename, __dirname) { // Copyright Joy
2015-07-24T06:58:23.502785+00:00 app[web.1]: 
2015-07-24T06:58:23.502786+00:00 app[web.1]: Error: ENOENT, no such file or directory '/app/public/favicon.ico'
2015-07-24T06:58:23.502791+00:00 app[web.1]:     at favicon (/app/node_modules/serve-favicon/index.js:47:15)
2015-07-24T06:58:23.502788+00:00 app[web.1]:     at Error (native)
2015-07-24T06:58:23.502789+00:00 app[web.1]:     at Object.fs.statSync (fs.js:797:18)
2015-07-24T06:58:23.502792+00:00 app[web.1]:     at module.exports (/app/server/config/express.js:32:13)
2015-07-24T06:58:23.502793+00:00 app[web.1]:     at Object.<anonymous> (/app/server/app.js:35:28)
2015-07-24T06:58:23.502795+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-07-24T06:58:23.502794+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-07-24T06:58:23.502797+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-07-24T06:58:23.502798+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
2015-07-24T06:58:23.502799+00:00 app[web.1]:     at Function.Module.runMain (module.js:501:10)
2015-07-24T06:58:23.521999+00:00 app[web.1]: 
2015-07-24T06:58:23.527299+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-07-24T06:58:23.527497+00:00 app[web.1]: npm ERR! node v0.12.7
2015-07-24T06:58:23.527870+00:00 app[web.1]: npm ERR! npm  v2.11.3
2015-07-24T06:58:23.528052+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2015-07-24T06:58:23.528208+00:00 app[web.1]: npm ERR! startup@0.0.0 start: `node server/app.js`
2015-07-24T06:58:23.528350+00:00 app[web.1]: npm ERR! Exit status 1
2015-07-24T06:58:23.528500+00:00 app[web.1]: npm ERR! 
2015-07-24T06:58:23.528642+00:00 app[web.1]: npm ERR! Failed at the startup@0.0.0 start script 'node server/app.js'.
2015-07-24T06:58:23.529501+00:00 app[web.1]: npm ERR! not with npm itself.
2015-07-24T06:58:23.529998+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-07-24T06:58:23.529302+00:00 app[web.1]: npm ERR! This is most likely a problem with the startup package,
2015-07-24T06:58:23.530188+00:00 app[web.1]: npm ERR!     node server/app.js
2015-07-24T06:58:23.530706+00:00 app[web.1]: npm ERR! You can get their info via:
2015-07-24T06:58:23.530887+00:00 app[web.1]: npm ERR!     npm owner ls startup
2015-07-24T06:58:23.531127+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-07-24T06:58:23.533571+00:00 app[web.1]: 
2015-07-24T06:58:23.533831+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2015-07-24T06:58:23.534025+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2015-07-24T06:58:24.420694+00:00 heroku[web.1]: Process exited with status 1
2015-07-24T06:58:24.435391+00:00 heroku[web.1]: State changed from starting to crashed

起初我认为这是我的favicon的一个问题,但在移动它并修改了一些服务器/配置文件后,我尝试上传一个我已经成功放在Heroku上的不同的AngularFullstack应用程序。当我尝试重新加载它时,即使我可以在自己的Heroku应用程序上更新它,它也会产生完全相同的错误。我也尝试创建其他Heroku应用程序,以防有问题的一个被破坏,但我仍然得到相同的错误。这让我觉得我试图上传到Heroku的方式有问题。

考虑到这一点,以下是我尝试部署到Heroku的步骤:

  1. $ cd dir
  2. $ heroku login
  3. $ heroku git:remote -a nameOfApp
  4. $ git init
  5. $ git add .
  6. $ git add -A
  7. $ git commit -m "doesntMatter"
  8. $ git push -f heroku

1 个答案:

答案 0 :(得分:1)

  

以下是我尝试部署到Heroku的步骤:1)$ cd dir 2)$ heroku login 3)$ heroku git:remote -a nameOfApp 4)$   git init 5)$ git add。 6)$ git add -A 7)$ git commit -m   &#34; doesntMatter&#34; 8)$ git push -f heroku

不要这样做!

将Yeoman堆栈推送到Heroku ,您必须执行以下操作:

grunt build
grunt buildcontrol:heroku

从那时起:

  1. 你会避免你刚才遇到的那种错误。
  2. 如果有的话,你将能够看到它失败的步骤。
  3. 如果仍然没有帮助,您可能需要查看:

    • 您的favicon文件是否可读?出于某些原因,当grunt未按预期启动时,来自grunt的图像最小化器可能会破坏它。如果不是,请更改它,并检查应用中的其他图像文件是否可读。

           Warning: Running "imagemin:dist" (imagemin) task
       Warning: Error: Command failed: /Users/stephane/Code/node/myapp/node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/vendor/optipng  -strip all -clobber -force -fix -o 3 -out /var/folders/1n/66pmh3zx3gj764pbfymx6rmh0000gn/T/7076e223-ac82-4405-96ba-af48869c6180
       /var/folders/1n/66pmh3zx3gj764pbfymx6rmh0000gn/T/00efe7c1-9ec2-42a1-80bc-47c3fa7a7578
       * Processing: /var/folders/1n/66pmh3zx3gj764pbfymx6rmh0000gn/T/00efe7c1-9ec2-42a1-80bc-47c3fa7a7578
       Error: PNG file appears to be corrupted by text file conversions
      
       * Status report
       1 file(s) have been processed.
       1 error(s) have been encountered.
       in file client/assets/images/picture123.png Use --force to continue.
      
    • https://github.com/gruntjs/grunt-contrib-imagemin/issues/214尝试npm cache clean && npm install gruntjs/grunt-contrib-imagemin。在这种情况下,npm install grunt-contrib-imagemin看起来也很有用:

           Warning: jit-grunt: Plugin for the "imagemin" task not found.
       If you have installed the plugin already, please setting the static mapping.
       See https://github.com/shootaroo/jit-grunt#static-mappings
      
       Warning: Task "imagemin" not found. Use --force to continue.