http-server with localhost:3000 gives ERR_INVALID_REDIRECT

后端 未结 6 1458
半阙折子戏
半阙折子戏 2020-12-19 06:08

I have installed http-server using the following command:

npm i -g http-server

Upon running the server I get the response saying Running o

6条回答
  •  太阳男子
    2020-12-19 06:23

    I'm having the exact same problem. Just installed both node and http-server globally. run http-server and it gives me the following error when accessing localhost:8080:

    "ERR_INVALID_REDIRECT"

    If I try to access the index.html page, it works. It doesn't even show directories listing, even with -d in the command line.

    I got something, though: installing an older version of http-server and it loads the index.html automagically :)

    This was the command/version: npm install -g http-server@0.8.5 Anything newer (0.9.0+) and it breaks again.

    Edit:

    Even then, it will only work on sub-folders, not on the root. For example:

    http://localhost:8080/mypage/ will load index.html automatically.

    http://localhost:8080/ won't

提交回复
热议问题