johnpapa / lite-server

Lightweight node server
MIT License
2.32k stars 268 forks source link

Trying to start an html website using NPM and Lite-server #201

Open Noman-Patel opened 3 years ago

Noman-Patel commented 3 years ago

Before you open an issue, please check if a similar issue already exists or has been closed before.

A descriptive title

The behavior you expect to see, and the actual behavior...

For feature requests, a description of the problem you're trying to solve, including why you think this is a problem.

Bug repro steps

Please give us an isolated way to reproduce the behavior (example: GitHub repository with code that anyone can clone to observe the problem, or a Dockerfile that replicates your environment):

1. 2. 3.

Environment

Noman-Patel commented 3 years ago

So I have to start an html file from the VS code terminal using npm start for my bootcamp. But I when I do that the webppage gives me an error cannot GET/. My instructor says its a linux problem Screenshot from 2021-09-26 12-01-40 Screenshot from 2021-09-26 12-01-34

Barabazs commented 3 years ago

@Nomal-patel lite-server can't find your index.html (see the 404 error)

Did you start lite-server from the same directory as where your index.html is saved?

Otherwise you should use --baseDir option. For example: My index.html is in the subfolder "src". So I start live-server like this: lite-server --baseDir='src'