I recently started getting this error when attempting to create a new component using the angular CLI:
newTree.optimize is not a function
the issued command was:
ng g c test
Googling return only articles from Angular CLI v6.x I have tried uninstalling and reinstalling Angular globally with no luck. Here is my current versioning:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.1.0
Node: 12.16.1
OS: win32 x64
Angular:
...
Ivy Workspace:
Package Version
------------------------------------------------------
@angular-devkit/architect 0.901.0
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@schematics/angular 9.1.0
@schematics/update 0.901.0
rxjs 6.5.4
has anyone else found a fix for this?
Thank you!
After I upgraded to angular 9, I had 2 packages that were both still at version 0.6.8, They were:
@schematics/[email protected]
@angular-devkit/[email protected]
For whatever reason, they were not upgraded and it resulted in this error.
The answer above was correct for me but I thought I'd expand on it, in case anyone else runs into the same issue...
@schematics/angular
@angular-devkit/schematics
@angular-devkit/core
were all on 0.6.8. Running the following resolved my issue:
npm install @schematics/angular
npm install @angular-devkit/schematics
npm install @angular-devkit/core
I hope this helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With