I'm learning AngularJS. I'm using npm http-server to run the project locally.
The problem is, whenever I make changes to App.js the change doesn't get reflected on the site. I try refreshing the page, it doesn't update the changes to JS. I also tried http-server -o -c-1 and still it doesn't refresh the cache.
The only thing that makes the App.js update is clearing the browser cache. How should I be doing this?
Clearing the cache To clear a cache in npm, we need to run the npm cache clean command followed by the --force flag in our terminal. clean: It deletes the all data from your cache folder.
How to clear cache? To clear a cache in npm, we need to run the npm cache clean --force command in our terminal. To clear the cache present in npm, you need to run the command. If it doesn't work, run the force clean method since the cache is not cleared simply.
Delete Cache and Refresh your page In most browsers, pressing Ctrl+F5 will force the browser to retrieve the webpage from the server instead of loading it from the cache.
Sorry a little late to the party,
When using npm http-server
just append -c-1 to the start command e.g.
npm http-server -c-1
Documentation http-server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With