Buidling the application after having upgraded dependcies to Angular 9 (and having performed necessary code changes) throws an error:
Compiling @ang
This issue is becuase you might be running your app on any port and angular ngcc was assigned with a particular process id which was specified and locked in a file called
__ngcc_lock_file__
inside \node_modules\@angular\compiler-cli\ngcc
.
If you are doing a hard system turn off or if your os crashed, this lock file will be there in the node_modules. And once you turn on you machine and trying to start the application again, angular cli will check this lock file and trying to find the process id specified in the file. Most of the time that process id will be missing since you did a complete machine restart and it will throw the this error.
Solution 1. remove node_modules
and do npm install
Solution 2. Smart solution - delete the lock file as below.
Go to `\node_modules\@angular\compiler-cli\ngcc`
find the file named __ngcc_lock_file__
delete it.
Done.
Happy hacking
Adding "postinstall": "ngcc"
to "scripts"
in package.json helped me to fix this
Setting "enableIvy": false in tsconfig.json does fix that particular error. Isn't Ivy supposed to be usable already?
This answer I found at enter link description here @clement911 answer and it worked for me after a lot of testing
Check your node.js version with node -v
. And check if Angular 9 is compatible with it.
Updating node.js to the latest LTS version (12.8.1) worked for me.
I did this with nvm (node version manager).
Found a good instruction here.