简体   繁体   English

运行grunt-contrib-imagemin时出错

[英]Getting error when running grunt-contrib-imagemin

I'm getting a permissions error -- or so it seems -- when I try to run the grunt-contrib-imagemin script. 当我尝试运行grunt-contrib-imagemin脚本时,出现权限错误-或似乎出现了错误。 I installed grunt-contrib-imagemin like so: 我像这样安装grunt-contrib-imagemin:

npm install --save-dev grunt-contrib-imagemin

My node and npm are installed in my local user root to avoid needing to use sudo. 我的节点和npm安装在我的本地用户root中,以避免需要使用sudo。 My setup for grunt-contrib-imagemin in my gruntfile is: 我在gruntfile中为grunt-contrib-imagemin设置的是:

grunt.initConfig({
        imagemin: {
            dynamic: {
                files: [{
                    expand: true,
                    cwd: 'content/',
                    src: ['**/*.{png,jpg,gif}'],
                    dest: '/dist'
                }]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-imagemin');

But when I run the commaand grunt imagemin I get the following error: 但是,当我运行逗号咕unt grunt imagemin ,出现以下错误:

Running "imagemin:dynamic" (imagemin) task Warning: Error: EACCES, mkdir '/dist' in file content/01-projects/01-corners-are-for-kissing-in/04-dana/lanningsmith_cornersdetail3.jpg Use --force to continue. 运行“ imagemin:dynamic”(imagemin)任务警告:错误:EACCES,文件内容中的mkdir'/dist'/01/projects/01-corners-are-kissing-in/04-dana/lanningsmith_cornersdetail3.jpg使用-力继续。

I've checked the permissions on these directories, and it all seems to be write: directories are 775 and files 666. The owners are my user and _www (the user for my server). 我已经检查了这些目录的权限,似乎都写了:目录是775,文件是666。所有者是我的用户和_www(我的服务器的用户)。 I assume that given that npm is installed locally that grunt should be running as my user and so there should be no problem. 我假设鉴于npm是本地安装的,因此grunt应该以我的用户身份运行,因此应该没有问题。 So I'm not sure what's going on here. 所以我不确定这是怎么回事。 Ideas? 想法?

Aborted due to warnings. 由于警告而中止。

Are you still seeing this issue? 您仍然看到此问题吗? If so, what version of grunt-contrib-imagemin are you using? 如果是这样,您正在使用什么版本的grunt-contrib-imagemin? I was having this issue as well, but updating to 0.9.1 resolved it. 我也遇到了这个问题,但是更新到0.9.1可以解决它。 See this post on their github page: https://github.com/gruntjs/grunt-contrib-imagemin/issues/252 请在其github页面上查看此帖子: https : //github.com/gruntjs/grunt-contrib-imagemin/issues/252

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:使用 grunt-contrib-imagemin 时为 png 文件生成 ENOENT - Error: spawn ENOENT for png files when using grunt-contrib-imagemin 如何使用grunt-contrib-imagemin插件无损优化图像? - How to lossless optimize images with plugins for grunt-contrib-imagemin? grunt-contrib-imagemin - 拍摄两个不同文件夹的图像 - grunt-contrib-imagemin - Take images of two different folders grunt-contrib-imagemin将文件输出到错误的文件夹 - grunt-contrib-imagemin outputting files to the wrong folder 为什么grunt-contrib-imagemin不使用我设置的选项? - Why is grunt-contrib-imagemin not using the option I set? 如果使用grunt-contrib-imagemin优化图像,如何在手柄模板中处理图像 - How to address images in handlebars templates if the images are optimized with grunt-contrib-imagemin travis-ci在grunt-contrib-imagemin任务上构建失败(无法准备未定义的属性“ contents” - travis-ci build failure on grunt-contrib-imagemin task (Cannot ready property 'contents' of undefined 为什么grunt-contrib-imagemin可以将PNG减少80%,将JPG减少&lt;0.1%? - Why doesn grunt-contrib-imagemin reduce PNGs by 80% but JPG by only <0.1%? 运行grunt插件grunt-contrib-cssmin时出错 - Error running grunt plugin grunt-contrib-cssmin 在grunt-contrib-jasmine任务中运行jasmine-jquery时出错 - Error running jasmine-jquery in grunt-contrib-jasmine task
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM