[英]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.