DEV Community

Cover image for Day 2: Error: "NGCC failed to run on entry-point"
Dipak Ahirav
Dipak Ahirav

Posted on

Day 2: Error: "NGCC failed to run on entry-point"

Scenario:

This error occurs when the Angular Compatibility Compiler (NGCC) fails to run on an entry-point during the build process. It typically happens after upgrading Angular or when there are issues with third-party libraries.

please subscribe to my YouTube channel to support my channel and get more web development tutorials.

Solution:

1.Run NGCC Manually:
Try running NGCC manually to see more detailed errors:

   ngcc
Enter fullscreen mode Exit fullscreen mode

2.Clean and Reinstall Node Modules:
Clean the npm cache and reinstall the node modules:

   npm cache clean --force
   rm -rf node_modules
   npm install
Enter fullscreen mode Exit fullscreen mode

3.Delete Angular Compiler Cache:
Sometimes the Angular compiler cache can cause issues. Delete the cache directory:

   rm -rf ./node_modules/.ngcc
Enter fullscreen mode Exit fullscreen mode

4.Update Angular Packages:
Ensure all Angular packages are updated to compatible versions:

   ng update @angular/core @angular/cli
Enter fullscreen mode Exit fullscreen mode

5.Check for Third-Party Library Issues:
If the issue persists, it might be caused by a third-party library. Check the compatibility of third-party libraries with your Angular version. You might need to update or downgrade specific packages.

6.Configure ngcc.config.js:
If a specific package is causing the issue, you can configure NGCC to skip it by adding a ngcc.config.js file to the root of your project:

   module.exports = {
     packages: {
       'problematic-package': {
         entryPoints: {
           './': { ignore: true }
         }
       }
     }
   };
Enter fullscreen mode Exit fullscreen mode

7.Rebuild the Project:
After performing the above steps, rebuild your project:

   ng build
Enter fullscreen mode Exit fullscreen mode

If you follow these steps and still encounter the error, it may be beneficial to look for any open issues related to NGCC on the Angular GitHub repository or the specific third-party library's repository.

Feel free to ask for another error and its solution tomorrow!

please subscribe to my YouTube channel to support my channel and get more web development tutorials.

Follow and Subscribe:

Happy coding! 🚀

Top comments (1)

Collapse
 
gadekar_sachin profile image
Sachin Gadekar

thank you for support