grunt-contrib-copy icon indicating copy to clipboard operation
grunt-contrib-copy copied to clipboard

EPERM error when trying to execute any copy task

Open kaffolder7 opened this issue 9 years ago • 1 comments

I am receiving an EPERM error that reads, _"Warning: EPERM, operation not permitted '/var/www/my-website/wp-content/themes/theme-1/library/css/flexslider.css' Use --force to continue."_ when running the grunt command in my console. My grunt task for reference is below:

dirs: {
    theme: '/var/www/my-website/wp-content/themes/theme-1'
},
copy: {
    main: {
        files: [
            {expand: true, cwd: '<%= dirs.theme %>/library/.css/', src: ['**'], dest: '<%= dirs.theme %>/library/css/'},
            {expand: true, cwd: '<%= dirs.theme %>/library/.js/', src: ['**'], dest: '<%= dirs.theme %>/library/js/'}
        ]
    }
}

Could someone please provide some insight as to why this task is failing? Even if I run grunt --force, it doesn't fail the Grunt build, but files are not successfully copied over. This used to work at one point in time, so I'm not sure why it's failing now. Newer build of 'grunt-contrib-copy' maybe? If someone could help me debug this, I would greatly appreciate it. Seems this is not an isolated issue/occurrence, as a quick Google search reveals that there are others having this issue, but following those StackOverflows, etc. does not yield a fix for me.

Thanks! I'm so grateful for any help!

kaffolder7 avatar Jul 19 '15 21:07 kaffolder7

I'm having the same issue with grunt-contrib-copy v1.0.0, which is the latest at the time of writing this. There doesn't seem to be an underlying OS permissions error, as I can cp the files from src to dest without sudo.

Many of the answers I found implicated minimatch patterns, which I'm not using on the command-line. However, those fixes haven't worked for me. grunt-contrib-copy doesn't use minimatch directly, and I am using older versions of grunt (v0.4.5), and thus minimatch (v0.2.14).

Relevant Gruntfile:

"copy": {
    "options": {
        "encoding": "utf8"
    }
    "release": {
        "expand": true,
        "cwd":    ""../releases/notification/",
        "src":    "**",
        "dest":   "/webroot/notification/"
    }
},

command-line:

[notification]$ grunt -vd copy:release

Running tasks: copy:release

Running "copy:release" (copy) task
[D] Task source: /code/node_modules/grunt-contrib-copy/tasks/copy.js
Verifying property copy.release exists in config...OK
Files: ../releases/notification/notification.min.css -> /webroot/notification/notification.min.css
Files: ../releases/notification/notification.js -> /webroot/notification/notification.js
Files: ../releases/notification/notification.min.js -> /webroot/notification/notification.min.js
Files: ../releases/notification/notification.min.js.map -> /webroot/notification/notification.min.js.map
Options: encoding="utf8", processContent=false, processContentExclude=[], timestamp=false, mode=false
Copying ../releases/notification/notification.min.css -> /webroot/notification/notification.min.css
Reading ../releases/notification/notification.min.css...OK
Writing /webroot/notification/notification.min.css...OK
Warning: EPERM, operation not permitted Use --force to continue.

Aborted due to warnings.

[notification]$ ll /webroot/notification/notification.min.css
-rw-rw-r-- 1 myuser mygroup 434 Jun 24 11:25 /webroot/notification/notification.min.css

[notification]$ touch /webroot/notification/notification.min.css
(no error)

[notification]$ cp ../releases/notification/notification.min.css /webroot/notification/notification.min.css
(no error)

nshew13 avatar Jun 24 '16 18:06 nshew13