elm-live: Error: listen EADDRINUSE :::8000 after change to Main.elm

When I run elm-live src/Main.elm -e node_modules/.bin/elm -o -- --debug everything works as normal/expected. Then when I make a change to Main.elm

view : Model -> Html Msg
view model =
  div []
    [ button [ onClick Decrement ] [ text "-" ]
    , div [] [ text (String.fromInt model) ]
    , button [ onClick Increment ] [ text "+" ]
    ]

such as commenting out view : Model -> Html Msg, the console starts repeatedly spamming:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::8000
    at Server.setupListenHandle [as _listen2] (net.js:1286:14)
    at listenInCluster (net.js:1334:12)
    at Server.listen (net.js:1421:7)
    at Object.<anonymous> (/Users/wolfgang.schuster/Experiment/elm/ark/node_modules/elm-serve/lib/elm-reload-server.js:93:8)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
Emitted 'error' event at:
    at Server.emit (events.js:182:13)
    at emitErrorNT (net.js:1313:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

OS: OSX 10.13.6 Node: 10.12.0

When using Node 8.12.0 the error changes to:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::8000
    at Server.setupListenHandle [as _listen2] (net.js:1360:14)
    at listenInCluster (net.js:1401:12)
    at Server.listen (net.js:1485:7)
    at Object.<anonymous> (/Users/wolfgang.schuster/Experiment/elm/ark/node_modules/elm-serve/lib/elm-reload-server.js:93:8)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

This should be fixed in the new alpha! You can check the README for how to install it.

So I think it’s Yarn. If I do npm run dev or npx elm-live src/Main.elm -e node_modules/.bin/elm -- --debug then everything works as expected, but running it with yarn dev causes the errors. I’m going to see if I can do a little more digging to better pin point the issue.

Yarn v1.12.1 and v1.12.3 btw, and thank you for all the help!