gpt4 book ai didi

node.js - grunt-contrib-copy 因不允许 EPERM 操作而死亡 "C:\Documents and Settings"

转载 作者:太空宇宙 更新时间:2023-11-04 02:49:20 25 4
gpt4 key购买 nike

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

Running "copy:main" (copy) task

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

Aborted due to warnings

我正在运行:

  • Windows 7 64 位(因此 C:\Documents and Settings 不存在)
  • node 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,其中没有空格或括号)上对“文档和设置”进行了全文搜索,但没有任何匹配项。

我的复制任务定义是:

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 还很陌生,所以我没有意识到以前的语法有问题;我不知何故得到的印象是它会被视为相对路径。

在发布我的问题之前,我四处寻找这个问题的答案。 Grunt 文档有 a good explanation of Grunt's globbing patterns (*, **, etc.) ,但它没有提到前导斜杠是一个问题。所以,我想我会把这个留给遇到此类问题的其他人。我希望它对其他人有帮助。

关于node.js - grunt-contrib-copy 因不允许 EPERM 操作而死亡 "C:\Documents and Settings",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23986623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com