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.

  1. install live-server globally
npm install -g live-server
  1. on project directory: npx live-server

  2. 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 serve

and simply run npx serve from inside my project directory. Sadly it doesn’t auto-reload pages (watch changes) and doesn’t have much feature (which is a feature, right? I guess?). Nonetheless, it covers the basics for me.