67

When I try to run ng serve command in my project it produce the below error.

ERROR in ngcc is already running at process with id xxxx

Shyam Narayan
  • 1,009
  • 2
  • 14
  • 28
  • 22
    Stop the serve and delete this file `node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file` – Jacopo Sciampi Mar 06 '20 at 08:52
  • 1
    deleting the ngcc_lock_file resolved the problem – Shyam Narayan Mar 06 '20 at 09:02
  • I had this issue too the first time I served an angular 9 application. Or better, I stopped the serve in a "not standard way". – Jacopo Sciampi Mar 06 '20 at 09:09
  • 4
    File was named `__ngcc_lock_file__` for me. Removing it resolved the problem here too. – rlv-dan Mar 10 '20 at 12:52
  • 1
    https://stackoverflow.com/a/61122898/3160597 – azerafati Jun 06 '20 at 07:50
  • I started getting this same error when I added a library to my workspace. Our custom build script run "ng build" in parallel and reported the error when building in parallel the two applications that use the new library. The fix for me was to enable Ivy in the the new library's tsconfig file. My guess is that the library is built using Ivy and then ngcc isn't needed when building the applications. – Steve Meierhofer Jan 08 '21 at 15:52
  • delete nodes_modules and re-run npm install, that was the issue in my case. – Amir Dora. Feb 06 '23 at 18:56

4 Answers4

211

Try deleting your ngcc_lock_file in the path:

node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file

Or for Angular 9, the lock file to delete is:

node_modules/@angular/compiler-cli/ngcc/__ngcc_lock_file__

I had the same issue and I and deleted that file and it started working for me.

starball
  • 20,030
  • 7
  • 43
  • 238
Compiler v2
  • 3,509
  • 10
  • 31
  • 55
54
 rm node_modules/@angular/compiler-cli/ngcc/__ngcc_lock_file__ 
Ole
  • 41,793
  • 59
  • 191
  • 359
16

Working Solution

  1. Delete all node modules
  2. Close any working terminal or you can shut down your PC if you cant make sure that you've closed all working terminals
  3. run npm i to setup your modules
  4. run ng s

It's working with me well !

Omar Hasan
  • 719
  • 7
  • 18
6

The problem is most-likely a unique case.

  1. Make sure you don't run other ng serve in parallel.
  2. Stop current processes running and retry.
  3. Reload your computer and try again.

If that does not help

Post a full log, so it is possible to troubleshoot your problem.

0leg
  • 13,464
  • 16
  • 70
  • 94
  • 1
    @Oleg, It seems to me there is some issue with the ngcc logic. – Malik Haseeb Mar 06 '20 at 08:33
  • If you are using Angular 9, is had 14 release candidates (the most tested Angular version up to date). If you are not using some very unique setup - it should have been tested by devs already. Post your config or the full log. – 0leg Mar 06 '20 at 08:46
  • @malik-haseeb indeed - on my observation, ngcc 13 has more issues with this than versions before! – Alexander Jul 24 '22 at 11:32