2

How do I disable the angular caching that occurs in the root of all of the Angular projects? This seemed to start last week when I installed NVM.

enter image description here

1
  • My project has an NPM package pulled from a local directory, which was stubbornly refusing to update in Angular when changed even after rerunning npm install. Disabling the CLI cache as per stackoverflow.com/a/70249096/2902555 fixed the issue. Commented Aug 14, 2024 at 10:34

2 Answers 2

7

Angular now supports the use of persistent build cache by default for new v13 projects.

To disable it you can run below command in your workspace root folder.

ng config cli.cache.enabled false

You can also disabled it by setting the "enabled" flag to "false" in angular.json file

"cli": {
    "cache": {
      "enabled": false
    }
  }

Reference:- https://angular.io/cli/cache

Sign up to request clarification or add additional context in comments.

2 Comments

THANK YOU. I've been searching everywhere to figure this out including Angular docs. Much appreciated.
@MarkLancaster If this answer your question please mark it as accepted. That will help others as well, thanks.
0

Vimal Patel's answer is accurate, but the following command will do the same without having to know the configuration path (documentation).

ng cache disable

However, disabling the build cache will not prevent npm packages in node_modules from being cached. Not only are packages in node_modules considered immutable unless the version in package.json changes, webpack also considers node_modules to be immutable.

1 Comment

disabling the build cache will not prevent npm packages in node_modules from being cached I think this is wrong, Angular cache does exactly that: caching packages in node_modules

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.