Problems Deploying Yeoman app to Heroku

2019-08-05 18:07发布

I've been trying to deploy my AngularFullstack (node) app to Heroku. I created the app in the terminal with: yo angular-fullstack. Whenever I try to deploy to Heroku I get the following when I go to my deployed app:

Application Error

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

The logs are:

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

At first I thought it was a problem with my favicon but after moving it around and tinkering with a number of server/config files I tried uploading a different AngularFullstack app that I already successfully put on Heroku. When I tried to reupload it, it produces the exact same error even though I can update it on its own Heroku app. I also tried creating other Heroku apps in case the one in question was corrupted but I still get the same error. This makes me think it is something wrong with the way I'm trying to upload to Heroku.

With this in mind, here are the steps that I'm trying to deploy to 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条回答
We Are One
2楼-- · 2019-08-05 18:25

Here are the steps that I'm trying to deploy to 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

Don't do that!


To push a Yeoman stack to Heroku, you must do:

grunt build
grunt buildcontrol:heroku

From then on:

  1. You will avoid the kind of mistake you just had.
  2. If anything, you will be able to see at which step it is failing.

If that still doesn't help, you might want to look at this:

  • is your favicon file readable? For some reasons, the image minimizer from grunt might have break it when grunt wasn't launched as expected. If it isn't, change it and also check whether the other image files in your app are readable.

         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.
    
  • try npm cache clean && npm install gruntjs/grunt-contrib-imagemin from https://github.com/gruntjs/grunt-contrib-imagemin/issues/214. And npm install grunt-contrib-imagemin also looks like being useful in that case:

         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.
    
查看更多
登录 后发表回答