I am facing this issue when trying to build angular-cli based 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)
Everything was working perfectly until I took 5 - 6 hour development break and then this error appeared. How can I pass {overwrite: true}
option to Broccoli?
I have found an issue with angular-cli
and posted here.
Finally, I found out that at one place where {overwrite: true}
option was missing when merging nodes.
Line 170 in angular-cli/lib/broccoli/angular2-app.js
merged = new BroccoliMergeTrees([merged, publicFolder]);
changed to
merged = new BroccoliMergeTrees([merged, publicFolder], {overwrite: true});
and everything is working fine now.
I have created a PR for this but unfortunately, Broccoli is gonna be removed in next angular-cli version.