grunt-contrib-copy死于EPERM操作不允许“C:\ Documents and Settings”

我正在尝试使用grunt-contrib-copy来运行一个简单的grunt任务,但它在到达复制任务时立即死亡,并带有以下消息:

运行“复制:主”(复制)任务

警告:EPERM,不允许操作'C:\ Documents and Settings'使用 – 强制继续

由于警告而中止

我在跑步:

  • Windows 7 64位(所以C:\Documents and Settings不存在)
  • 节点0.10.28(安装在C:\nodejs
  • npm 1.4.9
  • grunt-cli 0.1.13
  • 咕噜0.4.5
  • grunt-contrib-copy 0.5.0

我已经在C:\nodejs和我的项目文件夹( C:\Users\myusername\Documents\Programming\myprojectname ,在那里没有空格或圆括号)上对“Documents and Settings”进行了全文search,但没有任何匹配。

我的copy任务定义是:

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

什么可能导致这个错误?

我修好了它。 问题是原始代码中的src: '/**'属性。

我改变了它,现在它完美的作品:

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

/** src属性被打破, **/*正常工作。 我对Grunt很新,所以我没有意识到前面的语法是一个问题。 我不知何故得到了它将被视为相对path的印象。

在发布我的问题之前,我search了一个答案。 Grunt文档对Grunt的globbing模式( ***等)有很好的解释 ,但是没有提到引起斜线的问题。 所以,我想我会把这个问题留给任何遇到这种问题的人。 我希望它可以帮助别人。