无效的配置对象. Webpack已使用配置进行了初始化 [英] Invalid configuration object. Webpack has been initialised using a configuration

查看:1209
本文介绍了无效的配置对象. Webpack已使用配置进行了初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从今天早上开始,使用Angular CLI 1.0.0-beta.14ng new try3ng serve并得到以下错误:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'tslint'. These properties are valid:
   object { amd?, bail?, cache?, context?, devServer?, devtool?, entry, externals?, loader?, module?, name?, dependencies?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
 - configuration.module has an unknown property 'preLoaders'. These properties are valid:
   object { rules?, loaders?, noParse?, unknownContextRequest?, unknownContextRegExp?, unknownContextRecursive?, unknownContextCritical?, exprContextRequest?, exprContextRegExp?, exprContextRecursive?, exprContextCritical?, wrappedContextRegExp?, wrappedContextRecursive?, wrappedContextCritical? }
   Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.node.global should be a boolean.
 - configuration.resolve has an unknown property 'root'. These properties are valid:
   object { modules?, descriptionFiles?, plugins?, mainFields?, aliasFields?, mainFiles?, extensions?, enforceExtension?, moduleExtensions?, enforceModuleExtension?, alias?, symlinks?, unsafeCache?, cachePredicate?, fileSystem?, resolver? }
 - configuration.resolve.extensions[0] should not be empty.
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'tslint'. These properties are valid:
   object { amd?, bail?, cache?, context?, devServer?, devtool?, entry, externals?, loader?, module?, name?, dependencies?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
 - configuration.module has an unknown property 'preLoaders'. These properties are valid:
   object { rules?, loaders?, noParse?, unknownContextRequest?, unknownContextRegExp?, unknownContextRecursive?, unknownContextCritical?, exprContextRequest?, exprContextRegExp?, exprContextRecursive?, exprContextCritical?, wrappedContextRegExp?, wrappedContextRecursive?, wrappedContextCritical? }
   Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.node.global should be a boolean.
 - configuration.resolve has an unknown property 'root'. These properties are valid:
   object { modules?, descriptionFiles?, plugins?, mainFields?, aliasFields?, mainFiles?, extensions?, enforceExtension?, moduleExtensions?, enforceModuleExtension?, alias?, symlinks?, unsafeCache?, cachePredicate?, fileSystem?, resolver? }
 - configuration.resolve.extensions[0] should not be empty.
    at webpack (/home/jan/src/fm-repos/try3/node_modules/webpack/lib/webpack.js:16:9)
    at Class.run (/home/jan/src/fm-repos/try3/node_modules/angular-cli/tasks/serve-webpack.js:23:27)
    at /home/jan/src/fm-repos/try3/node_modules/angular-cli/commands/serve.js:84:26
    at process._tickCallback (internal/process/next_tick.js:103:7)

我最近一次ng new项目是几天前的-当时它可以工作.这是我的环境:

angular-cli: 1.0.0-beta.14
node: 6.5.0
os: linux x64

解决方案

将Angular CLI升级到1.0.0-beta.15或更好:

  npm uninstall angular-cli -g
  npm cache clean
  npm install angular-cli@latest -g

生成工作支架:

  ng new try4
  cd try4
  ng serve

如果您有使用Angular CLI的早期版本构建的现有项目,则需要升级:

  rm -rf node_modules dist tmp
  npm install angular-cli@latest --save-dev
  ng init

并仔细检查每个文件中的每个差异.

根本原因:Angular CLI版本正常工作后,当然应该停止工作.不幸的是,angular-cli 1.0.0-beta.14webpack: ^2.1.0-beta.22上具有插入符号"依赖项-请注意^.昨天,webpack发布了与angular-cli 1.0.0-beta.14不兼容的2.1.0-beta.23,因此,由于插入符号(^),angular-cli 1.0.0-beta.14的已部署版本已停止工作.为了解决此问题,昨天发布了angular-cli 1.0.0-beta.15,具有已修复 webpack: 2.1.0-beta.22依赖项-请注意>的缺失-从而避免了升级到webpack.有关详细信息,请参见 https://github.com/angular/angular-cli/issues/2234 ./p>

项目解决方法:如果您无法升级或不升级Angular CLI,则可以通过添加已将webpack依赖项修复为您自己的项目.当然,您必须继续保持这种依赖性:

  npm install webpack@2.1.0-beta.22 --save-dev

如果无法升级Angular CLI,请选择此替代方法.

As of this morning, with Angular CLI 1.0.0-beta.14 I ng new try3 and ng serve and get the following error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'tslint'. These properties are valid:
   object { amd?, bail?, cache?, context?, devServer?, devtool?, entry, externals?, loader?, module?, name?, dependencies?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
 - configuration.module has an unknown property 'preLoaders'. These properties are valid:
   object { rules?, loaders?, noParse?, unknownContextRequest?, unknownContextRegExp?, unknownContextRecursive?, unknownContextCritical?, exprContextRequest?, exprContextRegExp?, exprContextRecursive?, exprContextCritical?, wrappedContextRegExp?, wrappedContextRecursive?, wrappedContextCritical? }
   Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.node.global should be a boolean.
 - configuration.resolve has an unknown property 'root'. These properties are valid:
   object { modules?, descriptionFiles?, plugins?, mainFields?, aliasFields?, mainFiles?, extensions?, enforceExtension?, moduleExtensions?, enforceModuleExtension?, alias?, symlinks?, unsafeCache?, cachePredicate?, fileSystem?, resolver? }
 - configuration.resolve.extensions[0] should not be empty.
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'tslint'. These properties are valid:
   object { amd?, bail?, cache?, context?, devServer?, devtool?, entry, externals?, loader?, module?, name?, dependencies?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
 - configuration.module has an unknown property 'preLoaders'. These properties are valid:
   object { rules?, loaders?, noParse?, unknownContextRequest?, unknownContextRegExp?, unknownContextRecursive?, unknownContextCritical?, exprContextRequest?, exprContextRegExp?, exprContextRecursive?, exprContextCritical?, wrappedContextRegExp?, wrappedContextRecursive?, wrappedContextCritical? }
   Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.node.global should be a boolean.
 - configuration.resolve has an unknown property 'root'. These properties are valid:
   object { modules?, descriptionFiles?, plugins?, mainFields?, aliasFields?, mainFiles?, extensions?, enforceExtension?, moduleExtensions?, enforceModuleExtension?, alias?, symlinks?, unsafeCache?, cachePredicate?, fileSystem?, resolver? }
 - configuration.resolve.extensions[0] should not be empty.
    at webpack (/home/jan/src/fm-repos/try3/node_modules/webpack/lib/webpack.js:16:9)
    at Class.run (/home/jan/src/fm-repos/try3/node_modules/angular-cli/tasks/serve-webpack.js:23:27)
    at /home/jan/src/fm-repos/try3/node_modules/angular-cli/commands/serve.js:84:26
    at process._tickCallback (internal/process/next_tick.js:103:7)

The last time I ng new a project was a few days ago -- at that point it worked file. Here's my environment:

angular-cli: 1.0.0-beta.14
node: 6.5.0
os: linux x64

解决方案

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 webpack@2.1.0-beta.22 --save-dev

Choose this work-around if you can't upgrade Angular CLI.

这篇关于无效的配置对象. Webpack已使用配置进行了初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆