Ite*_*tor 3 json node.js angular-cli angular
我想按照这个答案从Angular5迁移到Angular6
我试图执行这三个命令,将.angular-cli.json更新为angular.json:
npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli
Run Code Online (Sandbox Code Playgroud)
不幸的是,仍然没有angular.json.如果我尝试运行ng serve,我会收到此错误:
Local workspace file ('angular.json') could not be found.
Run Code Online (Sandbox Code Playgroud)
所以我将.angular-cli.json重命名为angular.json.但它没有帮助:
架构验证失败,出现以下错误:数据路径""不应具有其他属性(项目).错误:架构验证失败,并出现以下错误:数据路径""不应具有其他属性(项目).在MergeMapSubscriber._registry.compile.pipe.operators_1.concatMap.validatorResult [as project](C:\ projects\my-app \node_modules\@ angular-devkit\core\src\workspace\workspace.js:173:42)at at MergeMapSubscriber._next(C:\ projects\my-app \node_modules\rxjs\internal\operators)中的MergeMapSubscriber._tryNext(C:\ projects\my-app \node_modules\rxjs\internal\operators\mergeMap.js:122:27)\mergeMap.js:112:18)在MergeMapSubscriber.notifyNext(C:\ projects\my)的MergeMapSubscriber.Subscriber.next(C:\ projects\my-app \node_modules\rxjs\internal\Subscriber.js:103:18) -app \node_modules\rxjs\internal\operators\mergeMap.js:141:26)在InnerSubscriber的InnerSubscriber._next(C:\ projects\my-app \node_modules\rxjs\internal\InnerSubscriber.js:30:21).在MapSubscriber._next订阅Subscriber.next(C:\ projects\my-app \node_modules\rxjs\internal\Subscriber.js:103:18)(C:\ projects\my-app \node_modules\rxjs\internal\operators\map .js:92:26)在MapSubscriber.Subscriber.next(C:\ projects\my-app \node_modules\rxjs\internal\Subscribe r.js:103:18)在SwitchMapSubscriber.notifyNext(C:\ projects\my-app \node_modules\rxjs\internal\operators\switchMap.js:122:26)
因此我试图运行ng update @angular/core,但我收到此错误:
工作区需要在使用前加载.
我错了什么?
您无法手动将文件.angular-cli.json重命名为angular.json.他们有不同的模式,因此你的错误.
删除现有的dir node_modules.确保你运行npm install @angular/cli并ng update @angular/cli从项目的根目录.如果未创建文件angular.json,请在控制台上读取输出 - 它应该会给您一些错误.
如果这没有帮助,只需使用Angular CLI 6生成一个新项目,并将现有项目中的src目录和资产复制到新生成的项目中.
我在博客中介绍了将Angular 5项目升级到Angular 6的经验:https://yakovfain.com/2018/05/16/how-i-migrated-a-dozen-of-projects-to-angular-6