Ole
Ole

Reputation: 46900

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?

Upvotes: 1

Views: 2525

Answers (2)

Salahuddin Ahmed
Salahuddin Ahmed

Reputation: 5650

Try removing node_modules folder and package-lock.json file then run the following command:

npm install

Or

npm uninstall -g @angular/cli

npm install -g @angular/cli

Upvotes: 1

TmTron
TmTron

Reputation: 19371

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

Upvotes: 2

Related Questions