http服务器-p 8082显示ERR_INVALID_REDIRECT

Jus*_*ode 4 service-worker progressive-web-apps angular

我正在从事有角度的项目。我想将PWA(渐进式Web应用程序)应用于我的应用程序。这是我遵循的命令。

ng build --prod
cd dist/appname
http-server -p 8082
Run Code Online (Sandbox Code Playgroud)

当我打开127.0.0.1:8082/#/或localhost:8082 /#/时,它显示以下错误

此页面无法正常运行localhost发送了无效的响应。ERR_INVALID_REDIRECT

如何解决?

小智 6

http-server has been broken recently, you can either :

  • use version 0.9.0 explicitly in your package.json ("http-server": "0.9.0",)
  • use another package that is not based on http-server like @Ruina suggested


Mat*_*ias 5

你必须直接打电话 index.html. 至少这就是刚才对我有用的方法。

试试:http : //127.0.0.1 : 8080/index.html