Buidling the application after having upgraded dependcies to Angular 9 (and having performed necessary code changes) throws an error:
Compiling @ang
npm i
ng serve
Worked for me
In my particular case the @angular-devkit/build-angular was updated to "^0.1001.2" in my package.json after running the npm audit fix. (This version seems to belong to angular 10, instead of the local projects' angular version (v9.1.7))
After reverting this change, everything started working again :
"@angular-devkit/build-angular": "~0.901.6"
Well in my case I was trying to run an angular project of an older version with a newer version of node. I did this:
Removes all the existing nodule modules.
rm -rf node_modules
update node js to latest
npm update
npm install
updates the angular project version to the latest
ng update @angular/core
updates the project cli to the latest
ng update @angular/cli
Now start the project
ng-serve
I had to go into my tsconfig.spec.json file and add
"angularCompilerOptions": {
"enableIvy": false
}
It was already in my tsconfig.json file.
Using terminal/cmd,
1st Step: ng update @angular/cli @angular/core
2nd Step: ng update
3rd Step: ng serve
Fixed mine.
NOTE Your custom css files in bootstrap folder might get deleted. Back them up before and place them back after the update!
Try to remove the node_modules
folder and run install again:
rm -rf node_modules
npm install
For me it has solved the problem.