Search code examples
angularangular-cliangular-package-format

Upgrading library projects to Angular 12?


I'm trying to run this on library projects / projects that have a workspace:

ng update @angular/core @angular/cli @angular/material

It worked on one project, however for the rest I always get:

Cannot locate bin for temporary package: @angular/cli

Any ideas?


Solution

  • I had the same issue after upgrading to ng 12.
    We use nrwl/nx which makes everything even more tricky...

    Workaround

    • install angular cli globally:
      npm install -g @angular/cli@latest
    • now get the path of this installation, e.g. in a new git-bash terminal (outside of my projects):
      which ng
      • will print e.g. /c/Program Files/nodejs/ng
        this should be the latest version that we have just installed
      • execute "/c/Program Files/nodejs/ng" --version to make sure that you have the newest version (12.0.3 in my case
    • now I can run my updates: e.g. "/c/Program Files/nodejs/ng" update @angular/flex-layout @angular/cdk @angular/material

    Notes

    • maybe this fix will help - should arrive in ng 12.1
    • I think this is a related bug-report: angular-cli#20843