1

I want to copy style.css in the build directory to overwrite the style.css in the main project directory.

This is my file structure

project
├── assets
│   ├── styles
│   │  └── build
│   │       └── style.css
│   └── gruntfile.js
└── style.css

In my gruntfile.js file I have:

copy: {
    dev: {
        files: [{
            cwd: 'styles/build/',
            src: 'style.css',
            dest: '../',
            expand: true
        }]
    }
},    

When I run grunt, I get this error:

Running "copy:dev" (copy) task
Warning: EPERM, operation not permitted '../style.css' Use --force to continue.

Aborted due to warnings.

But it does copy the file. I can't figure out why I am getting this error.

Thanks in advance.

laurayeffeth
  • 41
  • 1
  • 6

1 Answers1

0

Your paths are incorrect, ../dest is incorrect also, you have to put your destination in '.'.

Try it:

copy: {
    dev: {
        files: [{
            cwd: 'assets/styles/build/',
            src: 'style.css',
            dest: '../',
            expand: true
        }]
    }
},  

If you are using Windows, try to open your CMD as administrator. Maybe you have permission problems with your style.css

Mario Araque
  • 4,562
  • 3
  • 15
  • 25
  • From the file structure I gave, you are correct, but I made a mistake! The gruntfile.js file is in the assets directory, not the project directory. I've made the change to the original question. Sorry about that. – laurayeffeth Mar 06 '15 at 14:41
  • I am on a mac and permissions are correct for style.css. – laurayeffeth Mar 06 '15 at 14:43
  • I'm afraid that it's not possible to move files in a parent destination. Why don't move your gruntfile to the root folder? – Mario Araque Mar 06 '15 at 14:48
  • It is actually copying the file, though. It works, it just gives me that error and aborts afterwards. – laurayeffeth Mar 06 '15 at 15:11
  • I took your advice and moved gruntfile to the project directory and changed the copy code accordingly, but I get the same error (after again, successfully copying the file). – laurayeffeth Mar 07 '15 at 16:43
  • Try cleaning the node cache with `npm cache clean` – Mario Araque Mar 08 '15 at 21:13