peerDependencies error message

136 views
Skip to first unread message

Damon Smith

unread,
Jan 19, 2015, 5:49:41 AM1/19/15
to nod...@googlegroups.com
I just tried to use npm to install server-jsx and I got an error message saying:

The package envify does not satisfy its siblings' peerDependencies requirements!

and I wonder if there is a way to improve this error message, because this one is just no use to me. It seems to me, from reading this: http://blog.nodejs.org/2013/02/07/peer-dependencies/
that peer dependencies are basically saying "I'm not going to do dependency management for you on this package, you'll need to do it yourself". Now, I don't know, this probably isn't the case really but at the moment I have a different problem to get started on and I don't really want to know the massively complex detail of the npm dependency system. Yet. I'm sure I will soon enough, whether I like it or not, but I just want to put it off for now and try out react-jsx rendering on the server side.

So, can anyone tell me, would it be better for the error message to say something like:

Package server-jsx has a peer dependency on envify@~1.2.0 which has not been satisfied, which means you must manually include the envify package to be able to install server-jsx.

Or is that just not really what's happening here? Either way, I'm all about the error messages, and that one that needs some work.

thanks,

Damon

Aria Stewart

unread,
Jan 19, 2015, 1:15:53 PM1/19/15
to nod...@googlegroups.com

> On 19 Jan 2015, at 05:49, Damon Smith <damon....@gmail.com> wrote:
>
> I just tried to use npm to install server-jsx and I got an error message saying:
>
> The package envify does not satisfy its siblings' peerDependencies requirements!
>
> and I wonder if there is a way to improve this error message, because this one is just no use to me. It seems to me, from reading this: http://blog.nodejs.org/2013/02/07/peer-dependencies/
> that peer dependencies are basically saying "I'm not going to do dependency management for you on this package, you'll need to do it yourself". Now, I don't know, this probably isn't the case really but at the moment I have a different problem to get started on and I don't really want to know the massively complex detail of the npm dependency system. Yet. I'm sure I will soon enough, whether I like it or not, but I just want to put it off for now and try out react-jsx rendering on the server side.

That's not exactly what it does: peerDependencies are what every other dependency management system calls dependencies. It's the model where dependencies can conflict, in unresolvable ways: foo peerDepends on bar@2, baz peerDepends on bar@1: not resolvable. One of them would have to be broken.

Normal dependencies, because they're scoped in node, don't have this problem: if foo and baz need different bar modules, they each get a copy in node.

However, this can't express a "plugin" pattern dependency. If someone's made those, you're stuck with peerDependencies.

>
> So, can anyone tell me, would it be better for the error message to say something like:
>
> Package server-jsx has a peer dependency on envify@~1.2.0 which has not been satisfied, which means you must manually include the envify package to be able to install server-jsx.

That's not really a general solution: The solution is to use modules that depend on compatible versions of envify. If the requirements of a package are too narrow, that's a bug in that package.

>
> Or is that just not really what's happening here? Either way, I'm all about the error messages, and that one that needs some work.

Yeah. It's terrible, but explaining what's going on in the abstract often doesn't explain what's going on in any specific case. Suggestions are welcome, but it's not going to be easy!

Aria

Damon Smith

unread,
Jan 20, 2015, 12:31:50 AM1/20/15
to nod...@googlegroups.com
Thanks for the reply!

Sorry about this, but now I'm intrigued about peer dependencies and want to ask lots of questions.

1. ok so I think I have it, I grepped through my node_modules for peerDependency and the version of react under server-jsx has a peerDependency on envify ~1.2.0, and server-jsx itself also has a normal dependency on envify ~1.0.1

2. so packages that have peer dependencies must not conflict, and npm has the unenviable task of trying to find a version of the peer dependency that all packages are happy with. Now I understand your "requirements of a package are too narrow" statement. If that is the case, why not call them globalDependencies? Or is that muddying up the concept again?

3. And to finish, that means that server-jsx 0.0.2 can never have worked right? It seems like it's got a fundamental version conflict and it couldn't possibly ever work.

In this case, just to spitball an idea, the error message could be "Error, your package tree is trying to install envify as a peerDependency but also has a different version dependency elsewhere."

Ultimately it'd be nice if it told me that I've just tripped over someone else's crazy dependency problem - "package server-jsx can't be installed because it's dependencies have gone bonkers, just file a bug and walk away buddy". I don't know if that's possible though. Or if it's even the case.

Aria Stewart

unread,
Jan 20, 2015, 10:14:29 AM1/20/15
to nod...@googlegroups.com

> On Jan 20, 2015, at 12:31 AM, Damon Smith <damon....@gmail.com> wrote:
>
> Thanks for the reply!
>
> Sorry about this, but now I'm intrigued about peer dependencies and want to ask lots of questions.
>
> 1. ok so I think I have it, I grepped through my node_modules for peerDependency and the version of react under server-jsx has a peerDependency on envify ~1.2.0, and server-jsx itself also has a normal dependency on envify ~1.0.1

That sounds too tight: If they were to both use ^1.0.0, it should work great, assuming nobody mismarks something as compatible when it's not.

> 2. so packages that have peer dependencies must not conflict, and npm has the unenviable task of trying to find a version of the peer dependency that all packages are happy with. Now I understand your "requirements of a package are too narrow" statement. If that is the case, why not call them globalDependencies? Or is that muddying up the concept again?

It's not global, but just at that level: if you depended on something that depended on that server-jsx, then all this would be isolated into that node_modules, and not really affect your main app's.

> 3. And to finish, that means that server-jsx 0.0.2 can never have worked right? It seems like it's got a fundamental version conflict and it couldn't possibly ever work.

It may have: A prior release of react may have been compatible with server-jsx, and peer compatible with envify.

> In this case, just to spitball an idea, the error message could be "Error, your package tree is trying to install envify as a peerDependency but also has a different version dependency elsewhere."

Yeah, in this case, that might do it. But it could also be two peerDependencies that conflict.

> Ultimately it'd be nice if it told me that I've just tripped over someone else's crazy dependency problem - "package server-jsx can't be installed because it's dependencies have gone bonkers, just file a bug and walk away buddy". I don't know if that's possible though. Or if it's even the case.

Or use a different version, if that's possible. But I agree: this is terrible, and peerDependencies are the 'dependency hell' that other languages and package managers do by default.

Aria

Reply all
Reply to author
Forward
0 new messages