Reputation: 71
I just upgraded my project to Angular 9 on 07FEB20 and ever since whenever I add a library (is that the right word?) (such as ngx-bootstrap or ngx-gallery, which i'm using in another project and they're fine) I get this error in my console upon ng serve:
I goes away when I uninstall said libraries, but that's obviously not helpful because I'm at a stalemate as to what I can do with my project now.
Is there a way to downgrade Angular to some version of 8? I've tried the npm install -g @angular/[email protected]
(my previous version) but it seems like that's not enough to actually revert the project as not all elements are reverted to the 8 version.
I've been trying and Googling for 3 days and I'm at a loss as to how to integrate these libraries without errors coming up.
Oh also, I'm getting errors when these libraries are installed about Renderer vs Renderer2. Even changing those so they parse doesn't help. I still get the "cannot read property 'id'" error.
Upvotes: 0
Views: 3193
Reputation: 853
Make sure that angular 8 (whatever version you were previously using) is listed in your dependencies in package.json.
Instead of starting server with ng serve
start (from inside of angular project directory) using node_modules/.bin/ng serve
Using this method, You can have current version installed globally, yet still run certain projects using legacy versions (without the uninstall/reinstall headaches.)
Upvotes: 2
Reputation: 21698
In your package.json you can downgrade your angular cli version by changing @angular/cli: 9.x.x
to @angular/cli: 8.x.x
Upvotes: 0
Reputation: 235
to downgrade you can try
ng --version
npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli@8._._
ng --version
NOTE: put in the angular 8 version to where cli@8..
Upvotes: 1