Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm http-server keeps caching my App.js

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?

like image 236
AshleyKang Avatar asked Feb 25 '17 11:02

AshleyKang


People also ask

How do I disable npm cache?

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.

Can I delete npm cache?

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.

How do I refresh my HTTP server?

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.


1 Answers

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

like image 83
Natdrip Avatar answered Sep 17 '22 15:09

Natdrip