I literally just made a fresh installation of the Angular CLI in order to try it out and I don\'t have a clue on what\'s causing the following error on the command line:
I had same problem and this command did miracle for me
npm install copy-webpack-plugin@4.3.1
As stated here https://github.com/angular/angular-cli/issues/9550 it's a problem with copy-webpack-plugin.
It can be solved by doing npm install copy-webpack-plugin@4.3.0
EDIT: The issue is now fixed, so there is no need to use this workaround anymore.
Happens after upgrading @angular/cli
to 1.6.8
.
Solution: Problem is with copy-webpack-plugin
(https://github.com/webpack-contrib/copy-webpack-plugin/issues/217)
npm i copy-webpack-plugin@4.3.1 --save-dev
helps
NOTE: Previous offered solution was to downgrade cli to 1.6.7, which does not help.
Edit
Just execute yarn upgrade
.
There was a release of copy_webpack_plugin fixing the bug (4.4.1), so this should be preferred for resolving this issue. With npm, npm --depth 9999 update
should do the trick to update all dependencies recursively.
Regarding the depth argument for npm update:
As of npm@2.6.1, the npm update will only inspect top-level packages. Prior versions of npm would also recursively inspect all dependencies. To get the old behavior, use npm --depth 9999 update
Original answer below:
rm -rf node_modules package-lock.json
npm i copy-webpack-plugin@4.3.1 -E -O
npm i
Explanation:
-O
) and with an exact version (option -E
)Following github.com/angular/angular-cli/issues/9550 (thanks @oers for the link in the comments)
I just downgraded Anuglar CLI to version 1.6.7.
To do so, just type
npm uninstall -g @angular/cli
And once it finished install a previous version
npm install -g @angular/cli@1.6.7
NOTE: This will work but it is just a temporary solution, they probably -and hopefully- hot fix this.
EDIT: Actually I tried the wrong project which wasn't using CLI, tried again and it doesn't work, if you follow the github thread, it looks like a big thing, as it doesn't work with CLI 1.5.x nor 1.6.x (didn't tried with the others). It looks like the only thing we can do ATM is either debug through or sit and wait.
OOPS!
This issue should now be resolved with v4.4.1 released just now. https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v4.4.1