从Angular5迁移到Angular6时,angular.json不会更新

从Angular5迁移到Angular6时,angular.json不会更新,json,node.js,angular,angular-cli,Json,Node.js,Angular,Angular Cli,我想从Angular5迁移到Angular6,如下所示 我尝试执行这三个命令,将.angular cli.json更新为angular.json: npm install -g @angular/cli npm install @angular/cli ng update @angular/cli 不幸的是,仍然没有angular.json。如果我尝试运行ng service,我会收到以下错误: Local workspace file ('angular.json') could not b

我想从Angular5迁移到Angular6,如下所示

我尝试执行这三个命令,将.angular cli.json更新为angular.json

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli
不幸的是,仍然没有angular.json。如果我尝试运行
ng service
,我会收到以下错误:

Local workspace file ('angular.json') could not be found.
因此,我将.angular cli.json重命名为angular.json。但这没有帮助:

架构验证失败,出现以下错误:数据路径“” 不应具有其他属性(项目)。错误:架构 验证失败,出现以下错误:不应使用数据路径“” 具有其他属性(项目)。 在MergeMapSubscriber._registry.compile.pipe.operators_1.concatMap.validatorResult [作为项目] (C:\projects\my app\node\u modules\@angular devkit\core\src\workspace\workspace.js:173:42) 在MergeMapSubscriber.\u tryNext(C:\projects\my app\node\u modules\rxjs\internal\operators\mergeMap.js:122:27) 在MergeMapSubscriber.\u下一步(C:\projects\my app\node\u modules\rxjs\internal\operators\mergeMap.js:112:18) 在MergeMapSubscriber.Subscriber.next(C:\projects\my app\node\u modules\rxjs\internal\Subscriber.js:103:18) 在MergeMapSubscriber.notifyNext(C:\projects\my app\node\u modules\rxjs\internal\operators\mergeMap.js:141:26) 在InnerSubscriber.\u下一步(C:\projects\my app\node\u modules\rxjs\internal\InnerSubscriber.js:30:21) 在InnerSubscriber.Subscriber.next(C:\projects\my app\node\u modules\rxjs\internal\Subscriber.js:103:18) 在MapSubscriber.\u下一步(C:\projects\my app\node\u modules\rxjs\internal\operators\map.js:92:26) 在MapSubscriber.Subscriber.next(C:\projects\my app\node\u modules\rxjs\internal\Subscriber.js:103:18) 在SwitchMapSubscriber.notifyNext(C:\projects\my app\node\u modules\rxjs\internal\operators\switchMap.js:122:26)

因此,我尝试运行
ng update@angular/core
,但出现以下错误:

Local workspace file ('angular.json') could not be found.
工作区需要在使用前加载


我做错了什么?

您不能手动将文件.angular-cli.json重命名为angular.json。它们有不同的模式,因此会导致错误

删除现有的dir节点_模块。确保从项目的根目录运行
npm install@angular/cli
ng update@angular/cli
。如果没有创建angular.json文件,请在控制台上读取输出-它会给您带来一些错误

如果这没有帮助,只需使用Angular CLI 6生成一个新项目,并将src dir和资源从现有项目复制到新生成的项目中


我在博客中介绍了我将Angular 5项目升级到Angular 6项目的经历:

它要求的是
Angular.json
,而不是
.Angular.json
检查包中是否更新了版本。你也尝试过重新加载你的工作区,特别是当你使用VSC作为编辑器时。我使用记事本++作为编辑器。我得到需要加载工作区的
错误,即使文件名没有DOT,我认为您不需要手动将文件名.angular.cli.json更改为angular.json。更新后,如果成功,配置应自动从.angular.cli.json迁移到angular.json。检查package.json中的版本是否已更新,并运行一次npm安装。这可能对您有所帮助-在任何地方都没有提到更改文件名。但即使使用新名称,我也得到了需要加载的
工作区
错误