per live-server readme:
AJAX requests don’t work with the file:// protocol due to security restrictions, i.e. you need a server if your site fetches content through JavaScript.
- install
live-serverglobally
npm install -g live-server-
on project directory:
npx live-server -
view at
localhost:8080
I recently found a seemingly better alternative: serve is more actively maintained, smaller, and looks prettier on terminal too. I installed it globally,
npm install -g serveand simply run npx serve from inside my project directory. Haven’t explored the features much but it covers the basics for me.