Angular version update giving an error - Migration failed: Could not find any tsconfig file

Viewed 1920

I am trying to update an Angular project (in version 8) to version 9. when running the ng update it gives an error saying

Migration failed: Could not find any tsconfig file. Cannot migrate dynamic queries.

after some time. but when check the version it shows as 9. but many required changes are not there.

any solution or workaround is appreciated.

4 Answers

I got the same error upgrading from angular 8 to 9. I had a tsconfig file in my project and it was linked well. In my case the error was caused by the @angular-devkit/schematics package. I resolved the error by the following steps:

  1. remove the package @angular-devkit/schematics from your package.json
  2. delete the node_modules and package-lock.json
  3. npm i (I need to execute npm i --legacy-peer-deps - but be careful with that)
  4. npx @angular/cli@9 update @angular/core@9 @angular/cli@9

Let me now if this worked. Hope this might help someone

It says cannot migrate to dynamic queries please try the below code

npx @angular/cli@9 update @angular/core@9 @angular/cli@9 --force

When I was hit with this error. All I had to do was, run; 'ng update'. I was given the suggestion what to do next. Attached for reference below;

In my case I had to run as suggested; 'ng update @angular/core@12'

āœ– Migration failed: Could not find any tsconfig file. Cannot migrate AbstractControl.parent accesses.
  See "/private/var/folders/s/C/K/angular-errors.log" for further details.

    app_code % ng update
    Using package manager: 'npm'
    Collecting installed dependencies...
    Found 29 dependencies.
        We analyzed your package.json, there are some packages to update:
        
          Name                               Version                  Command to update
         --------------------------------------------------------------------------------
          @angular/core                      11.2.14 -> 12.2.9        **ng update @angular/core@12**

In order to run the migrations you need to install the @angular-devkit/core package

npm i @angular-devkit/core@<VERSION> -D
ng update --from <FROM_VERSION> --to <VERSION> --migrate-only --allow-dirty --verbose @angular/core

After migrations you could remove the package again.

Related