'Error: unsupported Elm version null' on Windows
ianmackenzie opened this issue · comments
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.
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
- What are your versions of
node.js
andnpm
? - Did you use
cmd.exe
to runelm-doc-preview
? - The
0.19.0
on the line after the error is suspect aselm-doc-preview
should just printError: unsupported Elm version ${version}
and exits. As the error would be different ifelm
were not found, I believe it is found but the version string is somewhat corrupted.elm-doc-preview
first tries to runnpx --no-install elm --version
in case a local elm install is used, so could you try to runnpx --no-install elm --version
and copy/paste here the output please? - Is there any color in your output of
elm --version
?
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: zkat/npx#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.
This should be fixed in elm-doc-preview@1.0.4.
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...)
Great! I would still advise to update your node.js version if you can (or fix your PATH else as explained in zkat/npx#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.