3

I'm new in using NPM. I wanted to load my project website in live server, but whenever I type live-server in the terminal, it only shows LISTING DIRECTORY (which is the list of all the files I have in my project website folder such as html, css, & script) instead of loading my project website. I tried to google it but found no answer. I don't know what to make sure or what to do about it.

izee
  • 183
  • 2
  • 4
  • 10

1 Answers1

4

If you don't specify a directory index somewhere (the default is a file named index.html) the server doesn't know what file you want to use as an entry point, so it'll just respond with a directory listing.

The docs say, you can add an index file by specifying the --entry-file command line parameter:

serve this file (server root relative) in place of missing files (useful for single page apps)

Just add the entry point to the startup script, by running

$ live-server --entry-point=PATH
Luca Kiebel
  • 9,790
  • 7
  • 29
  • 44