grunt-contrib-imagemin输出“致命错误:ENOENT,没有这样的文件或目录” [英] grunt-contrib-imagemin output "Fatal error: ENOENT, no such file or directory"
问题描述
命令 grunt imagemin
将以下内容输出到一个随机文件中。
The command grunt imagemin
output the following to a random file.
Fatal error: ENOENT, no such file or directory 'app/public/assets/img/epg/recordseries.png'
有趣的是,每次我再次运行命令grunt imagemin时,它会设法处理几个文件,并通过输出关于另一个文件的相同错误结束。
What's funny is that each time I run the command grunt imagemin again, it manages to process a few more files and ends by outputting the same error about another file.
我正在使用
I'm using
node v0.10.24
npm 1.3.21
grunt@0.4.2
grunt-contrib-imagemin@0.5.0 node_modules/grunt-contrib-imagemin
+-- filesize@2.0.0
+-- async@0.2.9
+-- chalk@0.4.0 (has-color@0.1.2, ansi-styles@1.0.0, strip-ansi@0.1.1)
+-- image-min@0.1.2 (mkdirp@0.3.5, cache-file@0.1.2, mout@0.7.1, optipng-bin@0.3.1, jpegtran-bin@0.2.3, gifsicle@0.1.4)
这是我为 imagemin
任务完成的grunt配置:
Here is my grunt config for imagemin
task:
grunt.config('imagemin', {
options: {
optimizationLevel: 3, // 0 to 7, default =7)
// pngquant: true
},
dynamic: { // Multiple target
files: [{
expand: true, // Enable dynamic expansion
cwd: '<%= context.source %>/assets/img/', // equal to app/wesource/assets/img/
src: ['!**/*-'+arrayToRegexStr(platformIgnoreList)+'**', '**/*.{png,jpg,jpeg,gif}'], // Actual patterns to match //
dest: '<%= context.public %>/assets/img/' // equal to app/public/assets/img/
}]
}
});
推荐答案
卸载0.5.0版并返回到版本0.3 .0使用以下命令应恢复之前的功能:
Uninstalling version 0.5.0 and going back to version 0.3.0 with the following commands should restore the prior functionality:
npm uninstall grunt-contrib-imagemin
npm install --save-dev grunt-contrib-imagemin@0.3.0
有一个问题, https://github.com/gruntjs/grunt-contrib-imagemin/issues/ 140 ,这是正在进行的,当它被修复时,应该是安全的升级。
There is an issue, https://github.com/gruntjs/grunt-contrib-imagemin/issues/140, that is being worked on, and when it is fixed it should be safe to upgrade.
这篇关于grunt-contrib-imagemin输出“致命错误:ENOENT,没有这样的文件或目录”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!