角色cli中.DS_Store文件的Broccoli MergeError

时间:2016-07-24 05:38:03

标签: angular angular-cli broccolijs

我在尝试构建基于angular-cli的app时遇到了这个问题。

Build failed.
The Broccoli Plugin: [BroccoliMergeTrees] failed with:
Error: Merge error: file .DS_Store exists in /private/var/www/myapp/src/app/tmp/broccoli_merge_trees-input_base_path-W89nbkgj.tmp/0 and /private/var/www/myapp/src/app/tmp/broccoli_merge_trees-input_base_path-W89nbkgj.tmp/1
Pass option { overwrite: true } to mergeTrees in order to have the latter file win.
    at BroccoliMergeTrees._mergeRelativePath (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/broccoli-merge-trees/index.js:266:17)
    at BroccoliMergeTrees.build (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/broccoli-merge-trees/index.js:70:24)
    at /private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/broccoli-plugin/read_compat.js:61:34
    at lib$rsvp$$internal$$tryCatch (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

The broccoli plugin was instantiated at: 
    at BroccoliMergeTrees.Plugin (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/broccoli-plugin/index.js:10:31)
    at new BroccoliMergeTrees (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/broccoli-merge-trees/index.js:30:10)
    at Angular2App._buildTree (/private/var/www/myapp/src/app/node_modules/angular-cli/lib/broccoli/angular2-app.js:170:14)
    at new Angular2App (/private/var/www/myapp/src/app/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
    at module.exports (/private/var/www/myapp/src/app/angular-cli-build.js:10:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
    at Class.module.exports.Task.extend.init (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
    at new Class (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
    at /private/var/www/myapp/src/app/node_modules/angular-cli/addon/ng2/commands/test.js:63:30
    at lib$rsvp$$internal$$tryCatch (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
    at /private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
    at lib$rsvp$asap$$flush (/private/var/www/myapp/src/app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

一切都运转良好,直到我花了5到6个小时的开发休息,然后出现了这个错误。如何将{overwrite: true}选项传递给Broccoli?

2 个答案:

答案 0 :(得分:2)

我有同样的问题,删除临时文件夹

没有运气

我所做的是递归删除.DS_Store 1.打开终端并进入项目文件夹
2.最后,在命令行中键入:
find . -name '*.DS_Store' -type f -delete

https://jonbellah.com/recursively-remove-ds-store/

它对我有用

答案 1 :(得分:1)

我发现angular-cli存在问题并发布了here

最后,我发现在合并节点时缺少{overwrite: true}选项的地方。

angular-cli / lib / broccoli / angular2-app.js中的第170行

merged = new BroccoliMergeTrees([merged, publicFolder]);

更改为

merged = new BroccoliMergeTrees([merged, publicFolder], {overwrite: true});

现在一切正常。

我有created a PR这个但不幸的是,Broccoli将在下一个angular-cli版本中删除。