3

I would like to migrate from Angular5 to Angular6, following this answer

I tried to execute this three commands, to update .angular-cli.json to angular.json:

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli

Unfortunately, there is still no angular.json. If I try to run ng serve, I get this error:

Local workspace file ('angular.json') could not be found.

So I renamed .angular-cli.json to angular.json. But it did not help:

Schema validation failed with the following errors: Data path "" should NOT have additional properties(project). Error: Schema validation failed with the following errors: Data path "" should NOT have additional properties(project). at 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 MergeMapSubscriber._tryNext (C:\projects\my-app\node_modules\rxjs\internal\operators\mergeMap.js:122:27) at MergeMapSubscriber._next (C:\projects\my-app\node_modules\rxjs\internal\operators\mergeMap.js:112:18) at MergeMapSubscriber.Subscriber.next (C:\projects\my-app\node_modules\rxjs\internal\Subscriber.js:103:18) at MergeMapSubscriber.notifyNext (C:\projects\my-app\node_modules\rxjs\internal\operators\mergeMap.js:141:26) at InnerSubscriber._next (C:\projects\my-app\node_modules\rxjs\internal\InnerSubscriber.js:30:21) at InnerSubscriber.Subscriber.next (C:\projects\my-app\node_modules\rxjs\internal\Subscriber.js:103:18) at MapSubscriber._next (C:\projects\my-app\node_modules\rxjs\internal\operators\map.js:92:26) at MapSubscriber.Subscriber.next (C:\projects\my-app\node_modules\rxjs\internal\Subscriber.js:103:18) at SwitchMapSubscriber.notifyNext (C:\projects\my-app\node_modules\rxjs\internal\operators\switchMap.js:122:26)

Therefore I tried to run ng update @angular/core, but I get this error:

Workspace needs to be loaded before it is used.

What do I wrong?

7
  • its asking for angular.json, not .angular.json Commented Jun 3, 2018 at 15:04
  • Check if the versions are updated in package.json. Also did you try reloading your workspace, esp if you are using VSC as your editor. Commented Jun 3, 2018 at 15:06
  • I use notepad++ as editor. I get the Workspace needs to be loaded error even if the name of the file is without the dot Commented Jun 3, 2018 at 15:08
  • 1
    i dont think you need to manually change the file name .angular.cli.json to angular.json. Once you update and if its successful automatically the configuration should migrate from .angular.cli.json to angular.json. Check if the versions are updated in package.json and run npm install once. This can of some help for you - Angular Update Commented Jun 3, 2018 at 15:20
  • It is not mentioned anywhere to change the file name. But even with the new name, I get the Workspace needs to be loaded error Commented Jun 3, 2018 at 15:23

1 Answer 1

6

You can't manually rename the file .angular-cli.json into angular.json. They have different schemas hence your errors.

Delete the existing dir node_modules. Make sure you run npm install @angular/cli and ng update @angular/cli from the root dir of your project. If the file angular.json is not created, read the output on the console - it should give you some errors.

If this doesn't help, just generate a new project using Angular CLI 6 and copy the src dir and assets from your existing project into the newly generated one.

I blogged about my experience of upgrading Angular 5 projects to Angular 6 here: https://yakovfain.com/2018/05/16/how-i-migrated-a-dozen-of-projects-to-angular-6

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.