安装 npm install http-server -g 运行 http-server -p 1234 -p 后面是端口号,可以换 就可以在浏览器中访问了,记得加端口号,无需写一行代码就有了一个 server