Html 通过终端为npm http服务器提供服务时出错。(错误404)

Html 通过终端为npm http服务器提供服务时出错。(错误404),html,angularjs,node.js,httpserver,Html,Angularjs,Node.js,Httpserver,我一直在尝试为我的HTML文件运行本地http服务器,因为我发现ng view存在的问题是,由于安全原因,chrome不支持跨源请求。因此,我下载了npm http服务器,并尝试运行我的html代码,得到错误消息: Starting up http-server, serving indexTemplate.html Available on: http://127.0.0.1:8080 http://172.27.88.21:8080 Hit CTRL-C to stop the se

我一直在尝试为我的HTML文件运行本地http服务器,因为我发现ng view存在的问题是,由于安全原因,chrome不支持跨源请求。因此,我下载了npm http服务器,并尝试运行我的html代码,得到错误消息:

Starting up http-server, serving indexTemplate.html
Available on:
  http://127.0.0.1:8080
  http://172.27.88.21:8080
Hit CTRL-C to stop the server
[Mon Jun 27 2016 19:48:11 GMT+0900 (KST)] "GET /" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36"
[Mon Jun 27 2016 19:48:11 GMT+0900 (KST)] "GET /" Error (404): "Not found"

有人能帮我弄清楚问题是什么以及我如何解决它吗?任何建议和帮助都将不胜感激

尝试在只有
indexTemplate.html
的文件夹中运行
http服务器
而不使用
indexTemplate.html
作为参数,它应该可以正常工作。

在服务时,请确保服务的是整个文件夹,而不是文件。 例如:不对

http服务器/home/ubuntu/sandbox/basicserver/index.html“

但对:


http服务器/home/ubuntu/sandbox/basicserver/“

那么您是否尝试转到
http://127.0.0.1:8080/indexTemplate.html
是的,如果没有
indexTemplate.html
,它就不会尝试运行
http服务器。我只是试着在一个只有index.html的文件夹中运行
http服务器
,它工作得很好谢谢!我不知道您只是在文件夹而不是文件中运行http服务器。现在很有魅力,赫罗库也犯了同样的错误