Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live server can't be run from a relative project directory. #434

Open
briancullinan2 opened this issue Sep 3, 2024 · 0 comments
Open

Live server can't be run from a relative project directory. #434

briancullinan2 opened this issue Sep 3, 2024 · 0 comments

Comments

@briancullinan2
Copy link

Before submitting an issue, please, see https://github.com/tapio/live-server#troubleshooting

Issue description

Live-server requires an absolute path for root.

Software details

  • Command line used for launching live-server:
  • OS: NPM
  • Browser (if browser related): Chrome
  • Node.js version: v22.5.1
  • live-server version: live-server 1.2.2

Basic example

  1. run npm init inside your project.
  2. run npm install live-server to add it as a dependency to package.json
  3. put this script in package.json "start": "live-server --root=docs" or rename docs to a project within your project directory.
  4. run npm start

This is how I expect the NPM live-server, as a developer, to use live server. This is how I want to use live-server, this is how I want to start it. This is how I want other people to be able to start my server. My instructions for other people using my project are npm install and npm start.

Outcome

Live server starts in a directory relative to the root of my system /docs/

Expected

Live server to append the --root path to $(cwd) internally when one directory exists and the other directory does not exist

Currently, there is no way described in the instructions to launch live server with a path relative to my project, and then transfer those launch commands to someone else's computer because they are absolute paths. Even though my project can handle relative paths, live-server cannot. This is a very very very basic use case that live-server doesn't support and it should be removed as an NPM package if it can't be used this way.

Maybe an option --relative-root is necessary here so that I can instruct people how to launch my project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant