Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error when using elm-pages docs #445

Open
supermario opened this issue Nov 16, 2023 · 9 comments
Open

Compilation error when using elm-pages docs #445

supermario opened this issue Nov 16, 2023 · 9 comments

Comments

@supermario
Copy link
Contributor

As discussed, there seems to be some issue with elm-pages docs, hypothesis it might be something to do with the Lamdera deps injection not being done in the background by elm-pages.

Screenshot 2023-11-16 at 11 04 47
@thelayeredmind
Copy link

Hey there, running into the same problem unfortunately. It keeps me from compiling the docs.
I checked the package constraints and they seem to be correct on my end. I've tried to investigate more into
lamdera/codecs but could not find much about it. I also tried to install in manually with elm install lamdera/codecs which returns @supermario 's message. Please tell me, if I can help in any way investigating this further, or point me to a relevant issue or source related to this package.

I am running it on my WSL 2 (5.15.133.1-microsoft-standard-WSL2),
with elm-pages (3.0.11),
elm (0.19.1) with the two packages "elm/bytes": "1.0.8", "elm/core": "1.0.5"

@Erudition
Copy link

Same problem here, is there a way to see docs otherwise?

@thelayeredmind
Copy link

@Erudition I believe not, since the main point of the local docs, is that they are able to reflect your locally generated code, for routes and other components. Do you use the same elm and elm-pages version as me? (Just out of curiosity)

@supermario
Copy link
Contributor Author

@thelayeredmind I'm not sure where you were looking at those deps, but it would be lamdera install lamdera/codecs if you wanted to add that package.

That said, my hypothesis is this is happening because of wherever elm-pages is building the docs harness. I already have the deps in my project's elm.json:

# mario ~/dev/projects/elmcraft.org ± main x
$ cat elm.json | ack lamdera
            "lamdera/codecs": "1.0.0",
            "lamdera/core": "1.0.0",

So in this instance I don't think project deps are the issue.

@thelayeredmind
Copy link

@supermario I think there has been a misunderstanding. The deps are not the problem, I also knew that. I found that lamdera/codecs are specified in the deps list of elm.json in the generated code (./elm-stuff/elm-pages/elm.json, ).
However the error message asked for local compilation to get more information. I was unsure about that part.
I am curious and wanted to investigate this issue further.
I installed the package with lamdera install lamdera/codecs, but all this ended up doing is to add the deps to my list and not building the package itself:

$ lamdera install lamdera/codecs
Here is my plan:

  Add:
    lamdera/codecs    1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: Y
Success!

My questions therefor are these:

  • Where can I find more documentation about lamdera/codecs ?
  • How can I build the package locally within my elm-pages environment to identify any further problems?

@dillonkearns
Copy link
Owner

The problem is that elm-doc-preview uses an elm executable, but lamdera/codecs is a special dependency that is built in to lamdera.

There are a few places where I inject lamdera/codecs into the elm.json of some internal generated sub-projects. I could remove it from the right place, but I need to make sure that it doesn't break compilation for those sub-projects either. If it does, then it would require a more substantial amount of work to have a separate hidden project to use for running the docs server.

@dillonkearns
Copy link
Owner

Okay, so it is a shared folder. The easy way to do it is to just not add lamdera/codecs when it's generating that folder for elm-pages docs, but if you're also running a dev server at the same time (which would be quite common) then the file generation for those two would be fighting each other. So I think it's going to need to be reworked to generate a separate sub-folder with its own elm.json to use.

@thelayeredmind
Copy link

@dillonkearns Awesome that you are on it, I appreciate that. But isn't this just combatting the sympton instead of the root cause?
Why is the package lamdera/codecs fighting with the package constraints in the first place? It seems to be matching those rules.
I personally use the dev server and would like to run the docs aswell. But it is not project breaking; I can just navigate the generated code for reference for now, it would just be a nice to have. Usually I can fix most problems on my own, but I got stuck on this one, since I don't really understand where the core problem lies and can't find anythign about this topic other than this issue.

@dillonkearns
Copy link
Owner

@thelayeredmind lamdera/codecs is a sort of magic dependency that Lamdera knows about, but Elm does not. There's not really much more to know about it, the message that the Elm compiler gives about it is not helpful, it's just a dependency that is not meaningful to Elm because it is a special Lamdera package that can only be installed and used by Lamdera.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants