dmy / elm-doc-preview

Elm offline documentation previewer
https://www.npmjs.com/package/elm-doc-preview
Other
128 stars 15 forks source link

elm-doc-preview crashes after 30 seconds #40

Open MartinSStewart opened 4 years ago

MartinSStewart commented 4 years ago

If I run elm-doc-preview, it will successfully show me my package documentation but after about 30 seconds, it will crash and the documentation I was viewing will refresh and tell me the page failed to load.

C:\Users\Martin\Desktop\elm-codec-bytes>npx elm-doc-preview
elm-doc-preview 5.0.3 using elm 0.19.1
Previewing MartinSStewart/elm-serialize 1.0.0 from C:\Users\Martin\Desktop\elm-codec-bytes
Browse <http://localhost:8000> to see your documentation
  |> watching package
  |> building C:\Users\Martin\Desktop\elm-codec-bytes documentation
  |> detected src\Serialize.elm modification
  |> building C:\Users\Martin\Desktop\elm-codec-bytes documentation
  |> sending Docs
  |> building C:\Users\Martin\Desktop\elm-codec-bytes documentation
TypeError: Cannot read property 'length' of null

This is occurring on Windows 10 with Firefox. I haven't tested any other OS's or browsers.

rlefevre commented 4 years ago

Thank you for reporting. Could you tell me your exact version of Node.js please.

Also, does it also crash when running outside your project (in any other directory, without arguments, it should show the documentation from local cache packages)?

MartinSStewart commented 4 years ago
>node --version
v10.16.0

I tested running elm-doc-preview outside of my project and that worked. Then I ran it inside my project again and that also worked. Now it seems to run fine. I'm not sure what changed between yesterday and now...

rlefevre commented 4 years ago

It seems to be the same issue as https://github.com/dmy/elm-doc-preview/issues/32, but it was not reproduced either. Please report if you ever manage to reproduce it.

MartinSStewart commented 4 years ago

I got it to crash again. Here's the logs from when it occurred outside of a project

C:\Users\Martin\Desktop>npx elm-doc-preview
npx: installed 136 in 17.772s
elm-doc-preview 5.0.3 using elm 0.19.1
No package or application found in C:\Users\Martin\Desktop, running documentation server only
Browse <http://localhost:8000> to see your documentation
TypeError: Cannot read property 'length' of null
C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:313
        throw er
        ^

Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\Martin\AppData\Roaming\npm-cache\_npx\14736\node_modules\elm-doc-preview\static'
    at Object.rmdirSync (fs.js:684:3)
    at rmkidsSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:356:25)
    at rmdirSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:334:7)
    at rimrafSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:304:9)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:342:5
    at Array.forEach (<anonymous>)
    at rmkidsSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:341:26)
    at rmdirSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:334:7)
    at rimrafSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:304:9)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:342:5

I'm not sure if it's related but I noticed this happening again after running lamdera live which also uses port 8000. I first started elm-doc-preview while lamdera live was running and while elm-doc-preview seemed to start fine, going to http://localhost:8000 showed me my lamdera app, not the documentation preview. After I turned off lamdera live and started elm-doc-preview again, elm-doc-preview started exhibiting the same symptoms as before with showing the documentation briefly and then crashing.