generator-angular-fullstack icon indicating copy to clipboard operation
generator-angular-fullstack copied to clipboard

dist images .png corrupt?

Open jmbrnrd opened this issue 12 years ago • 15 comments

I'm very much a newbie as far as a full stack approach so please bear with me. I have installed angular-fullstack for the first time, and answered 'y' to all options. Running grunt serve generates a local version perfectly. Great. However, running 'serve:dist' or 'dist' failed and some searching appeared to point to the imagemin process as a culprit. On this thread https://github.com/gruntjs/grunt-contrib-imagemin/issues/16 Sindre Sorhus suggested updating grunt-contrib-imagemin to fix a similar issue. This update appeared to fix the issue and both 'serve:dist' and 'dist' built successfully. Unfortunately the 1 .png image used in the demo seems to get corrupted and will not render. Any help would be appreciated?

jmbrnrd avatar Feb 23 '14 21:02 jmbrnrd

Hi James,

Did you get any errors while the npm install was running, or when running grunt serve:dist? The grunt-contrib-imagemin package can often have issues with installing. This might explain why updating imagemin fixed the serve:dist task for you.

DaftMonk avatar Feb 23 '14 21:02 DaftMonk

Thanks for the speedy response!

Very strangely, I just tried adding 2nd .png file and running grunt serve:dist which rendered both the default and additional image correctly - weird. Removing the 2nd image and running again causes the default image not to render ???

No error on install (that I noticed) but this was the original 'serve:dist' error, before I updated the imagemin:

Warning: Assertion failed: (!uv__io_active(&stream->io_watcher, UV__POLLOUT) || !ngx_queue_empty(&stream->write_completed_queue) || !ngx_queue_empty(&stream->write_queue) || stream->shutdown_req != NULL || stream->connect_req != NULL), function uv_read_stop, file ../deps/uv/src/unix/stream.c, line 1329. Use --force to continue.

jmbrnrd avatar Feb 23 '14 21:02 jmbrnrd

That 2nd image thing appears not to be consistent (or was I imagining it...). Back to image not rendering from dist build. If it's at all useful I got as far as putting the demo app on Heroku - with non-rendering image: http://jmbrnrd-0000.herokuapp.com/

jmbrnrd avatar Feb 23 '14 21:02 jmbrnrd

Hmm, this might be related to the grunt-rev task, which is used to rewrite asset names for the usemin task, specifically for caching purposes.

Do you see a difference in the image names referenced in the html, compared to the image names in your dist/public/images folder?

DaftMonk avatar Feb 23 '14 22:02 DaftMonk

OK. Checking image names revealed that both images had identical version prefixes. I tried adding a 3rd image and sure enough, all images rendered perfectly again (I wasn't going mad) and had unique version prefixes. Stopping the server and repeating reproduced the issue, with non-rendered images and all images being given identical (in fact the very same as before) version prefixes.

Some kind of cache issue?

jmbrnrd avatar Feb 23 '14 22:02 jmbrnrd

Well I checked the heroku version you put up and I can see that the image is actually returning a 200, despite the fact that response appears empty.

I'm not exactly sure how rev works, but I think it creates the hash prefix based on the file contents. So if they both have the same prefix it could be because they both had 0 contents to begin with, which fits with what I'm seeing on the heroku instance.

In that case, there has to be something going on with imagemin where its just creating empty images in the dist folder rather than compressing them.

DaftMonk avatar Feb 23 '14 22:02 DaftMonk

Maybe you could try deleting your node_modules folder and running npm install again. I haven't experienced this issue with my images, so I'm thinking this is likely a system issue, or a problem with the installation.

DaftMonk avatar Feb 23 '14 22:02 DaftMonk

...and the duplicated version prefix is the very same one, everytime 'd41d8cd9'.

I'll give the npm install a try. Thanks.

jmbrnrd avatar Feb 23 '14 22:02 jmbrnrd

Hmmm. That puts me back to where I started, with the grunt serve:dist error aborting the process just after svgmin

Running "svgmin:dist" (svgmin) task

Done, without errors.


Execution Time (2014-02-23 22:29:56 UTC)
loading tasks    5ms  ▇ 1%
svgmin          24ms  ▇▇▇ 5%
svgmin:dist    433ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 90%
Total 480ms
    Warning: Assertion failed: (!uv__io_active(&stream->io_watcher, UV__POLLOUT) || !ngx_queue_empty(&stream->write_completed_queue) || !ngx_queue_empty(&stream->write_queue) || stream->shutdown_req != NULL || stream->connect_req != NULL), function uv_read_stop, file ../deps/uv/src/unix/stream.c, line 1329. Use --force to continue.

    Aborted due to warnings.

jmbrnrd avatar Feb 23 '14 22:02 jmbrnrd

Maybe your node version is outdated? What version are you using? Found this from googling that error https://github.com/joyent/node/issues/5622

DaftMonk avatar Feb 23 '14 22:02 DaftMonk

I'm on v0.10.10. What's the best way of updating?

jmbrnrd avatar Feb 23 '14 22:02 jmbrnrd

If you're using windows, chocolatey is the easiest. http://chocolatey.org/packages/nodejs

DaftMonk avatar Feb 23 '14 22:02 DaftMonk

Node update did the trick, many thanks for taking time out to help and keep up the great work.

jmbrnrd avatar Feb 24 '14 05:02 jmbrnrd

Same problem, different solution https://github.com/gruntjs/grunt-contrib-imagemin/issues/140 grunt serve:dist was generating an empty {{number}}.yeoman.png file. Adding {cache : false} to imagemin options did the trick.

Thanks for such an awesome generator.

herrerodani avatar Mar 12 '14 13:03 herrerodani

Tive o mesmo problema, apenas apaguei a pasta DISTe gerei novamente e resolveu

gusta-of avatar May 08 '24 23:05 gusta-of