我正在尝试运行一个简单的计数器示例应用程序(来自here):
import Html exposing (button, div, text)
import Html.Events exposing (onClick)
main =
Html.beginnerProgram {
model = init,
update = update,
view = view
}
init =
{ count = 0 }
type Msg = Increment
view model =
div[] [
text model.count,
button [ onClick Increment ][ text "increment" ]
]
update = Increment model =
{ model | count = model.count + 1 }
我的项目文件夹如下:
package.json // created with npm init , npm install --save-dev elm
elm.json // since elm init fails, copy-pasted from https://github.com/elm/compiler/blob/master/docs/elm.json/application.md
src/Main.elm // the file shown above
node_modules/...
当我尝试运行elm init
(在创建elm.json之前)或elm make src/Main.elm
或elm install elm-lang/html
时,出现以下错误(套接字号不同):
-HTTP问题------------------------------------------- ---------------------
以下HTTP请求失败:
<https://package.elm-lang.org/all-packages>
这是我能够提取的错误消息:
HttpExceptionRequest Request { host = "package.elm-lang.org" port = 443 secure = True requestHeaders = [("User-Agent","elm/0.19.0"),("Accept-Encoding","gzip")] path = "/all-packages" queryString = "" method = "GET" proxy = Nothing rawBody = False redirectCount = 10 responseTimeout = ResponseTimeoutDefault requestVersion = HTTP/1.1 } (InternalException (HostCannotConnect "package.elm-lang.org" [Network.Socket.connect: <socket: 728>: failed (Connection timed out (WSAETIMEDOUT))]))
在elm reactor
中尝试打开Main.elm
时,我也会得到相同的结果(以防万一,请在底部截屏)。
这是elm
二进制文件的问题吗?我在Windows上安装了elm 0.19;我试图禁用防火墙,以防万一,但这无济于事。
任何想法可能是问题的根源吗?谷歌搜索给出的结果不相关...不确定如何解决此问题。