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

Warning: Cannot read property 'cyan' of undefined

Open alexbeletsky opened this issue 12 years ago • 10 comments

Install task, added configuration file

        copy: {
            js: {
                expand: true,
                files: [
                    {
                        src: 'public/build/main.js',
                        rename: function (dest, src) {
                            return dest;
                        }
                    }
                ]
            },
            css: {

            }
        }

After grunt run, getting

Running "copy:js" (copy) task                                                 
Warning: Cannot read property 'cyan' of undefined Use --force to continue.    

Node 0.8.22, Windows 8

alexbeletsky avatar May 15 '13 19:05 alexbeletsky

Forgot to add dest, not an issue.

alexbeletsky avatar May 16 '13 08:05 alexbeletsky

@alexanderbeletsky , thx!

stevermeister avatar Jan 28 '14 14:01 stevermeister

Just saw this today, it's kind of a weird error message, probably should tell you you're missing dest (I was using dst since that matches src)

kevin1024 avatar Apr 15 '14 01:04 kevin1024

Weirdest error message ever. I'm gonna reopen this to look into changing that.

jamesplease avatar Apr 15 '14 01:04 jamesplease

Super wierd IMO too, just got it!

bluehallu avatar Jun 20 '14 17:06 bluehallu

+1

kitzberger avatar Jul 16 '14 09:07 kitzberger

+1 (also thanks for the comments)

romuleald avatar Jul 21 '14 12:07 romuleald

fwiw, I just got this error (in grunt v0.4.5, node 0.10.32) during an exorcise task where I'd forgotten to update paths to reflect the paths used in other tasks. I'd venture to guess this erroneous error tends to show up in file/path not found situations.

+1

tydaeus avatar Dec 20 '14 22:12 tydaeus

I also just got this error and thank god someone had written about it (I too forgot dest). As a newby dev I didn't think it was something in my source code that was causing the issue. Would love a clearer error message!

EclecticKlos avatar May 22 '15 00:05 EclecticKlos

Hi,

I need to rename files at their source itself, and hence do not expect to specify a 'dest'. Also my files are specific ones in separate locations.

But it seems 'dest' must be specified. Can someone please help me out on how to specify dest to be same as whatever path from the array 'src' is processed currently; within grunt-contrib-copy.

I would appreciate this great help, as I am really stuck with plenty of trial-and-errors!! :'(

Updating with my task code:

copy: {
      taskName: {
        files: {
          src: [
            './src/<folder a>/<file a.js>',
            './src/<folder a>/<file b.js>',
            './src/<folder b>/<file c.js>',
            './src/<folder c>/<folder c'>/<file d.js>',
            './src/<folder d>/<folder d'>/<folder d''>/<file e.js>'
          ],
          rename: function(dest, src){
            return src + "V" + parseInt(Math.random() * Math.pow(10, 10));
          }
        }
      }
    }

I need to place the renamed files in the same destination as its 'src'. Also, these specified files are not the only ones in the parent-folder. I do not want to apply this versioning to other files, except for the ones i mentioned.

Please help me out!

amnambiar avatar Oct 28 '16 08:10 amnambiar