【发布时间】:2015-02-17 09:12:02
【问题描述】:
我正在关注本教程:https://www.youtube.com/watch?v=I1USsIW8aWE 在分钟 21:09 时调用了一个 http-server。
我的 Windows 盒子上安装了节点。我还使用 npm 安装了 http-server。
当我尝试运行服务器时出现此错误。
F:\Projects\LargeAppSpa\LargeAppSpa.FrontEnd
λ http-server src
C:\Users\Josh\AppData\Roaming\npm\node_modules\http-server\bin\http-server:51
if (err) throw err;
^
Error: listen EACCES
at exports._errnoException (util.js:746:11)
at Server._listen2 (net.js:1112:19)
at listen (net.js:1155:10)
at net.js:1253:9
at dns.js:85:18
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
认为这是一个端口问题,我运行了它,看起来它可以工作......
F:\Projects\LargeAppSpa\LargeAppSpa.FrontEnd
λ http-server src -p1234
Starting up http-server, serving src on: http://0.0.0.0:1234
Hit CTRL-C to stop the server
当我将浏览器导航到此位置时,我收到“页面无法显示消息”。
问题1)如何在没有端口的情况下使用http-server并使用默认的8080?
问题 2) 为什么这不起作用?我做错了什么?
谢谢!
【问题讨论】:
-
你能展示你的代码吗?
标签: javascript node.js httpserver