Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist images .png corrupt? #96

Closed
jmbrnrd opened this issue Feb 23, 2014 · 15 comments
Closed

dist images .png corrupt? #96

jmbrnrd opened this issue Feb 23, 2014 · 15 comments

Comments

@jmbrnrd
Copy link

jmbrnrd commented Feb 23, 2014

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 gruntjs/grunt-contrib-imagemin#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?

@DaftMonk
Copy link
Member

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.

@jmbrnrd
Copy link
Author

jmbrnrd commented Feb 23, 2014

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
Copy link
Author

jmbrnrd commented Feb 23, 2014

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/

@DaftMonk
Copy link
Member

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?

@jmbrnrd
Copy link
Author

jmbrnrd commented Feb 23, 2014

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?

@DaftMonk
Copy link
Member

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
Copy link
Member

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.

@jmbrnrd
Copy link
Author

jmbrnrd commented Feb 23, 2014

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

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

@jmbrnrd
Copy link
Author

jmbrnrd commented Feb 23, 2014

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.

@DaftMonk
Copy link
Member

Maybe your node version is outdated? What version are you using? Found this from googling that error nodejs/node-v0.x-archive#5622

@jmbrnrd
Copy link
Author

jmbrnrd commented Feb 23, 2014

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

@DaftMonk
Copy link
Member

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

@jmbrnrd
Copy link
Author

jmbrnrd commented Feb 24, 2014

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

@jmbrnrd jmbrnrd closed this as completed Feb 24, 2014
@herrerodani
Copy link

Same problem, different solution gruntjs/grunt-contrib-imagemin#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.

@gusta-of
Copy link

gusta-of commented May 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants