npm install throw a error
qizhenshuai opened this issue · comments
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'postcss'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
For typos: please correct them.
For loader options: webpack 2 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /.xxx$/, // may apply this only for some modules
options: {
postcss: ...
}
})
] - configuration.module.loaders[2].exclude should be one of these:
RegExp | non-empty string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }
Details:- configuration.module.loaders[2].exclude should be an instance of RegExp.
- configuration.module.loaders[2].exclude should be a string.
- configuration.module.loaders[2].exclude should be an instance of function.
- configuration.module.loaders[2].exclude should be an array:
[RegExp | non-empty string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }] - configuration.module.loaders[2].exclude should be an object.
- configuration.module.loaders[3].exclude should be one of these:
RegExp | non-empty string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }
Details:- configuration.module.loaders[3].exclude should be an instance of RegExp.
- configuration.module.loaders[3].exclude should be a string.
- configuration.module.loaders[3].exclude should be an instance of function.
- configuration.module.loaders[3].exclude should be an array:
[RegExp | non-empty string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }] - configuration.module.loaders[3].exclude should be an object.
- configuration.resolve has an unknown property 'root'. These properties are valid:
object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? } - configuration.resolve.extensions[0] should not be empty.
Solved. Please re clone code. It's because the dependence.