dmy / elm-doc-preview

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

'Error: unsupported Elm version null' on Windows #7

Closed ianmackenzie closed 5 years ago

ianmackenzie commented 5 years ago

I installed elm-doc-preview on Windows 10 with

npm install -g elm-doc-preview

When trying to run in a package directory I get the following error message:

c:\Git\ianmackenzie\elm-units>elm-doc-preview
Error: unsupported Elm version null
0.19.0

c:\Git\ianmackenzie\elm-units>elm --version
0.19.0

If it makes a difference, I installed Elm itself using the Windows installer, not via NPM - so it's on my PATH, but if elm-doc-preview is looking for it specifically in some Node directories then it won't find it.

rlefevre commented 5 years ago

Thank you for the report. I just tried with Windows 10 after having installed Elm with the official installer from https://github.com/elm/compiler/releases but I cannot reproduce the issue yet:

C:\Users\dmy\dev\elm-units>node --version
v10.14.2

C:\Users\dmy\dev\elm-units>npm --version
6.4.1

C:\Users\dmy\dev\elm-units>elm-doc-preview --version
1.0.3

C:\Users\dmy\dev\elm-units>elm-doc-preview
elm-doc-preview 1.0.3 using elm 0.19.0
Previewing ianmackenzie/elm-units 1.0.0 from C:\Users\dmy\dev\elm-units
  |> building documentation
  |> watching elm.json, README.md and *.elm files
Browse <http://localhost:8000> to see your documentation
rlefevre commented 5 years ago

I reproduced the issue with node.js 9.0.0 and npm 5.5.1, so you don't need to provide more information:

C:\Users\dmy\dev\elm-units>elm-doc-preview
Error: unsupported Elm version null
0.19.0

C:\Users\dmy\dev\elm-units>npm --version
5.5.1

C:\Users\dmy\dev\elm-units>node --version
v9.0.0

and the problem comes from this npx output:

C:\Users\dmy\dev\elm-units>npx --no-install elm --version
npx: installed 1 in 1.827s
The "path" argument must be of type string
null
0.19.0

And this is due to this issue: https://github.com/zkat/npx/issues/144

I am investigating a fix, until then the work-around is to update node.js or fix your PATH as explained in the issue.

rlefevre commented 5 years ago

This should be fixed in elm-doc-preview@1.0.4.

ianmackenzie commented 5 years ago

Thanks, just tested with 1.0.6 and it does indeed work! I'm excited to go write some docs now =)

(Apologies for not including my Node/NPM versions in the initial report, that was dumb...)

rlefevre commented 5 years ago

Great! I would still advise to update your node.js version if you can (or fix your PATH else as explained in https://github.com/zkat/npx/issues/144), as npx is a convenient tool, also its incorrect way of running in your node version also slows down a little the start of elm-doc-preview (nothing that bad though).

Note that you can also use elm-doc-preview during a package development, as it will display compilation errors too. So you can implement the package without building manually as it will detect modifications, recompile automatically, display errors if any, or documentation else.

Thanks for the bug report.