node.jsgruntjsgrunt-contrib-copy

grunt-contrib-copy dies with EPERM operation not permitted "C:\Documents and Settings"


I am trying to run a simple grunt task using grunt-contrib-copy, but it dies immediately on reaching the copy task, with this message:

Running "copy:main" (copy) task

Warning: EPERM, operation not permitted 'C:\Documents and Settings' Use --force to continue

Aborted due to warnings

I am running:

I have done a full-text search for "Documents and Settings" on both C:\nodejs and my project folder (C:\Users\myusername\Documents\Programming\myprojectname, with no spaces or parentheses in there), but nothing matches.

My copy task definition is:

copy: {
    main: {
        files: [
            {expand: true, cwd: 'src/core', src: '/**', dest: 'src/chrome/'},
            {expand: true, cwd: 'src/core', src: '/**', dest: 'src/firefox/'}
        ]
    }
},

What could be causing this error?


Solution

  • I fixed it. The problem was the src: '/**' properties in the original code.

    I changed it to this, and now it works perfectly:

    copy: {
        main: {
            files: [
                {expand: true, cwd: 'src/core', src: '**/*', dest: 'src/chrome/'},
                {expand: true, cwd: 'src/core', src: '**/*', dest: 'src/firefox/'}
            ]
        }
    },
    

    The /** src property was breaking it, and **/* works correctly. I'm pretty new to Grunt, so I didn't realize the former syntax was a problem; I somehow got the impression it would be treated as a relative path.

    I searched high and low for an answer to this before posting my question. The Grunt docs have a good explanation of Grunt's globbing patterns (*, **, etc.), but it doesn't mention leading slashes being a problem. So, I figured I would leave this up for anyone else who runs into this kind of problem. I hope it helps someone else.