I get this error trying to use a github repository as a dependency using elm-install

Problem in dependency repo_name/package_name 1.0.0

The elm-package.json constraints of 'repo_name/package_name' are probably
letting too much stuff through.

What does this exactly mean?

up vote 3 down vote accepted

(This answer courtesy of @ilias at Elm Slack channel)

It means that Elm couldn't compile the sources for that package in the context of your package.

Imagine for a minute I'm making a package my-fancy-package, and I have a dependency on a package foo/bar. So in my-fancy-package/elm-package.json, I could have a dependency like "foo/bar": "1.0.0 <= v < 2.0.0". Now, perhaps the most recent version of foo/bar while I'm developing my-fancy-package is 1.5.0. And in version 1.5.0, a new function was added that does exactly what I need in my-fancy-package, so I start using that function. The core issue is that there currently is no automated way to test that a package actually works with all the allowed versions of its dependencies. So now my-fancy-package says it depends on foo/bar at any version between 1.0.0 and 2.0.0, while in reality, it really needs to be at least 1.5.0 because I'm using a function from that package.

Now, imagine you're developing an application, and you're using foo/bar at version 1.2.3. According to the semver ranges of my-fancy-package, that means you should be able to use it, but if you were to actually try it, you'd receive this error: my-fancy-package is stating it is compatible with foo/bar@1.2.3 while it really needs 1.5.0.

The reason the error message doesn't simply say "it failed to compile" is because all the published packages are compiled before publishing. The most common reason for a package failing to compile in some context is that its dependencies aren't "accurate": they're letting too much stuff through.

In case of elm-install and packages from github, it's harder to say - it could actually be broken package.

Another common cause for this error is a rather silly one - conflicting definitions of infix operators. The associativity and precedence of infix ops can only be defined "globally", so if there are 2 packages that define the same infix operator, that could become a problem

  • Notably, in case of elm-install, to get more detailed error info, just put the library in a directory and add the path to the library's src/ subdir into "source-directories" section in elm-package.json of the including project (see also: discourse.elm-lang.org/t/…) – akavel Jun 7 at 23:28

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.