Invalid configuration object. Webpack has been initialised using a configuration
I just ran into this issue today running an ng2.0.0 project the solution was to downgrade webpack.
npm uninstall webpack --save-dev
npm install [email protected] --save-dev
this will probably be fixed soon on the package.json that angular-cli 1.0.0-beta.15
generates.
this fix should resolve the issue on any existing projects.
Are you using webpack2 beta?
If yes you can't have custom properties in configuration now.
you need to add your custom properties via plugins:
plugins: {
new webpack.LoaderOptionsPlugin({
options: {
postcss: ...
}
})
}
Upgrade Angular CLI to 1.0.0-beta.15
or better:
npm uninstall angular-cli -g
npm cache clean
npm install angular-cli@latest -g
which generates working scaffolds:
ng new try4
cd try4
ng serve
If you have an existing project built with prior versions of Angular CLI, you will need to upgrade:
rm -rf node_modules dist tmp
npm install angular-cli@latest --save-dev
ng init
and carefully review each of the differences in each file.
Root cause: Once a version of Angular CLI is working, it should not stop working, of course. Unfortunately, angular-cli 1.0.0-beta.14
has a "caret" dependency on webpack: ^2.1.0-beta.22
-- note the ^
. Yesterday, webpack
released 2.1.0-beta.23
which is not compatible with angular-cli 1.0.0-beta.14
so, due to the caret (^
), deployed versions of angular-cli 1.0.0-beta.14
have stopped working. To address this problem, angular-cli 1.0.0-beta.15
was released yesterday with a fixed webpack: 2.1.0-beta.22
dependency -- note the lack of the ^
-- thus avoiding the breaking upgrade to webpack. See https://github.com/angular/angular-cli/issues/2234 for details.
Project work-around: If you can't, or won't, upgrade Angular CLI, you can work-around the caret webpack dependency by adding a fixed webpack dependency to your own project. You'll have to maintain this dependency going forward, of course:
npm install [email protected] --save-dev
Choose this work-around if you can't upgrade Angular CLI.
npm uninstall webpack --save-dev
followed by
npm install [email protected] --save-dev
Then you should be able to gulp again. Fixed the issue for me.