最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Error: spawn ENOENT for png files when using grunt-contrib-imagemin - Stack Overflow

programmeradmin3浏览0评论

I am trying to press images with grunt-contrib-imagemin ~0.9.4 in a node.js application. My config is:

    imagemin: {
        dynamic: {
            files: [{
                expand: true,
                cwd: 'server/static/img/',
                src: ['**/*.{jpg,gif,png}'],
                dest: '_public/incl/img/'
            }]
        }
    },

I systematically get a Error: spawn ENOENT in file somepath/someimage.png message. It fails at the first processed .png file. When I don't include .png files, it all works fine.

I have read somewhere that I should copy the image files first in the target directory as a workaround. I have tried this, but it does not solve the issue.

I am on Windows 7 32-bits and I am using grunt ~0.4.5. How can I solve this issue?

I am trying to press images with grunt-contrib-imagemin ~0.9.4 in a node.js application. My config is:

    imagemin: {
        dynamic: {
            files: [{
                expand: true,
                cwd: 'server/static/img/',
                src: ['**/*.{jpg,gif,png}'],
                dest: '_public/incl/img/'
            }]
        }
    },

I systematically get a Error: spawn ENOENT in file somepath/someimage.png message. It fails at the first processed .png file. When I don't include .png files, it all works fine.

I have read somewhere that I should copy the image files first in the target directory as a workaround. I have tried this, but it does not solve the issue.

I am on Windows 7 32-bits and I am using grunt ~0.4.5. How can I solve this issue?

Share Improve this question asked Jul 1, 2015 at 19:56 Jérôme VerstryngeJérôme Verstrynge 59.6k96 gold badges295 silver badges466 bronze badges 2
  • 1 Did you try to disable the cache with options: { cache: false }? – Reto Aebersold Commented Jul 1, 2015 at 20:27
  • I just did, but it did not solve the issue. – Jérôme Verstrynge Commented Jul 1, 2015 at 20:38
Add a ment  | 

5 Answers 5

Reset to default 7

Blow away node_modules/grunt-contrib-imagemin and try and do a npm install again. The node equivalent of “did you restart it”?

I see in their github repo they have a couple of issues related to pngs, but nothing like you are seeing.

just reinstall the image-webpack-loader. That's worked for me.

This rebuild fixed my problem.

Laravel Mix Issues Optimising Images in Sass Files | Andy Carter

 $ npm rebuild mozjpeg  
 $ npm rebuild gifsicle  
 $ npm rebuild optipng-bin

Seems to be caused by a recent change in a package that imagemin is dependent on. The new setup doesn't support proxies until someone fixes it. https://github./kevva/download/issues/64

This thread suggests downgrading bin-build from 2.1.2 to 2.1.1

Just delete the node_modules folder and then run npm install or npm i to install all the modules again

发布评论

评论列表(0)

  1. 暂无评论