运行 index.html 在 npm 上

run index.html on npm

我是新手所以提前道歉。

我已经在终端中使用这些脚本安装了 npm

1.curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
2.nvm install node

然后我将它设置为 运行 像这样

http-server -a localhost
Starting up http-server, serving ./public
Available on:
http://localhost:8081

我有一个索引。 html 在我要显示的文档中。我试图在浏览器中声明整个路径,例如 http://localhost:8081/Documents/testServer/index.html

但这不起作用

您必须在包含 index.html 文件的文件夹中安装工具,如下所示