Jan*_*sen 28 angular2-cli angular
截至今天上午,具有角CLI的1.0.0-beta.14我ng new try3和ng 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)
Run Code Online (Sandbox Code Playgroud)
我上ng new一次项目的最后一次是在几天前 - 那时它工作文件.这是我的环境:
angular-cli: 1.0.0-beta.14
node: 6.5.0
os: linux x64
Run Code Online (Sandbox Code Playgroud)
Jan*_*sen 31
将Angular CLI升级到1.0.0-beta.15或更好:
npm uninstall angular-cli -g
npm cache clean
npm install angular-cli@latest -g
Run Code Online (Sandbox Code Playgroud)
它产生工作脚手架:
ng new try4
cd try4
ng serve
Run Code Online (Sandbox Code Playgroud)
如果您使用Angular CLI的早期版本构建现有项目,则需要升级:
rm -rf node_modules dist tmp
npm install angular-cli@latest --save-dev
ng init
Run Code Online (Sandbox Code Playgroud)
并仔细审查每个文件中的每个差异.
根本原因:一旦Angular CLI的版本正常工作,它当然不应该停止工作.不幸的是,angular-cli 1.0.0-beta.14有一个"插入符号"依赖上webpack: ^2.1.0-beta.22-注意^.昨天webpack发布了2.1.0-beta.23与之不兼容angular-cli 1.0.0-beta.14,由于caret(^),部署版本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.
项目解决方法:如果您不能或不会升级Angular CLI,您可以通过向您自己的项目添加固定的webpack依赖项来解决插入符号webpack依赖关系.当然,你必须保持这种依赖性:
npm install webpack@2.1.0-beta.22 --save-dev
Run Code Online (Sandbox Code Playgroud)
如果无法升级Angular CLI,请选择此解决方法.
the*_*mix 18
我今天遇到了这个问题,运行一个ng2.0.0项目解决方案是降级webpack.
npm uninstall webpack --save-dev
npm install webpack@2.1.0-beta.22 --save-dev
Run Code Online (Sandbox Code Playgroud)
这可能会很快修复angular-cli 1.0.0-beta.15生成的package.json .
此修复程序应解决任何现有项目的问题.
| 归档时间: |
|
| 查看次数: |
31025 次 |
| 最近记录: |