dependencies <> peerDependencies, dependencies seems wrong #3314

quenenni opened this Issue Apr 5, 2013 · 9 comments


None yet

5 participants


npm 1.2.16
etherpad-lite: 1.2.91

From a discussion here ether/etherpad-lite#1647

A plugin can have "dependencies" and?/or "peerDependencies" in their packages.json in order for them to have other plugins installed.

  • "peerDependencies" (already like this)
    • If the dependency plugin is not already installed, npm installs it inside the node_modules dir of the plugin. If plugin X needs plugin Y, plugin Y will be installed in node_modules/X/node_modules/Y
      In that case, Y won't be list as an installed plugin and won't be seen in the pad (if ie, that Y plugin adds something in the page like a button, .. that's good imo, as devs must know what they are doing)
    • If plugin Y was already installed, npm doesn't install it a second time (well maybe npm updates if the versions aren't the same, I didn't test that).
  • "dependencies" (not already like this)
    If plugin X depends on plugin Y, then Y should be installed as a plugin of the pad and not as a subplugin of the plugin X
    The tests I made show that in this case, Y is installed also inside the node_modules dir of the plugin X (if not already installed itself as a plugin) and is listed as an installed plugin but can not be uninstall
    But, more important, in this case, the plugin X won't work.
    (I had to manually copy the plugin Y into the node_modules dir of EPL)
    Another solution, for now, is to install the plugin Y first, then the plugin X. Then X will work without any further manipulation.

I don't know how it's suppose to work, I understand it's quite a tricky matter, but there should be a difference between "dependencies" and "peerDependencies" that do not really currently exist except that "dependencies" make plugins to not work.

@quenenni quenenni referenced this issue in nodejs/node-v0.x-archive Apr 5, 2013

peer-dependencies problems #5121

npm member

You seem pretty confused on how peer dependencies are supposed to work. Have you read ?

npm member

Yeah, what you're describing sounds like it's the opposite of how peerDependencies and dependencies work.

Can you provide a minimal test case where deps work one way, and describe what you'd like them to do instead?


Hmm.. I read the same article on (ha.. but it was yours reposted by someone else).

Ok. I re-read it and I must say that you are right.. I think I mixed what I remember having read (that's not easy stuff, for me) and some of my dreams :)
Sorry for that.

Then, let's go back to check the problem I've met with the installation of the plugins with dependencies.

I tried to install the plugin ep_slideshow ( that requires ep_heading
(the problem was exactly the same when I installed the plugin ep_list_pads ( that requires ep_public_view)

I tried the installation via the plugin page and via the "npm install" command.

The plugin has "dependencies" in its package.json file.
(I tested with "peerDependencies" and in that case, it works perfectly well)

npm install ep_slideshow
npm http GET
npm http 200
npm http GET
npm http 200
npm http GET
npm http 304
npm WARN package.json ep_headings@0.1.6 No file found!
ep_slideshow@0.1.9 node_modules/ep_slideshow
└── ep_headings@0.1.6

Then, when restarting the EPL server:

Ensure that all dependencies are up to date...  If this is the first time you have run Etherpad please be patient.
Ensure jQuery is downloaded and up to date...
Clear minfified cache...
ensure custom css/js files are created...
[INFO] console - Installed plugins: ep_fileupload, ep_etherpad-lite, ep_email_notifications, ep_historicalsearch, ep_draw, ep_page_view, ep_timesliderdiff, ep_linkify, ep_slideshow, ep_headings, ep_previewimages, ep_adminpads, ep_authornames
[ERROR] console - Failed to load 'ep_headings/index' for 'ep_headings/main/hooks/eejsBlock_editbarMenuLeft': Error: Cannot find module 'ep_headings/index'
[ERROR] console - Failed to load 'ep_headings/static/js/shared' for 'ep_headings/main/hooks/collectContentPre': Error: Cannot find module 'ep_headings/static/js/shared'
[ERROR] console - Failed to load 'ep_headings/static/js/shared' for 'ep_headings/main/hooks/collectContentPost': Error: Cannot find module 'ep_headings/static/js/shared'
[ERROR] console - Failed to load 'ep_headings/index' for 'ep_headings/main/hooks/getLineHTMLForExport': Error: Cannot find module 'ep_headings/index'
  • First, ep_heading is showed as installed in the plugin list (there is of course no ep_headins folder in node_modules dir of EPL).
    And via the plugin page and via 'npm' command, you can't uninstall it
npm uninstall ep_headings
npm WARN uninstall not installed in /home/etherpad/etherpad-lite/node_modules: "ep_headings"
  • Second, as EPL doesn't find it (see [ERROR] in console), the plugin ep_slideshow doesn't work
    The solution is to copy it from ep_slideshow to EPL:
cp -a node_modules/ep_slideshow/node_modules/ep_headings node_modules/

Restart the server and then, no more [Error] in EPL console and the plugin ep_slideshow works.

npm member

It sounds like this is an issue with how the ep_whatever authors have set up their dependencies. Could you ask them for support, instead of us? We have no knowledge of the ep_whatever ecosystem, or what an "EPL server" is, or what "plugin page" you're talking about.


EPL is EtherPad-Lite

Well, the discussion started in etherpad-lite github repo (the link in my first post)

They send me to your article (

At the end of the article, it's mentioned "Please post bugs and feature requests on the Node.JS github repository." (see link in my second post)

And NodeJs github repo send me here.. (pfuit)

So, with your last comment, I feel a bit like beating around the bush :)

I'm going to ask @JohnMcLear to join us as he's an EPL dev.

npm member

That's fair, and we're happy to help you toward a solution. But, from all the things you're describing, it seems likely this is more of an issue with EPL and/or your usage of it, rather than with npm :). So let's see what the EPL people say.


In the meantime, while brains are overheating in deep reflexions :)

If I understood (more) correctly the (peer)dependencies system, the dependencies plugins are installed inside the plugins that need them, but they are not active in the main system behind.

If a plugin need emailJs, that's ok as emailJs doesn't do/add/change anything to the interface.

But how am I supposed to manage a dependency that adds something to the interface.


the ep_headings plugin adds a dropdown list to set h1, h2, .. like styles to the text.

The ep_slideshow uses these h1 to generate the slideshow.

So, the problem is that by using the (peer)dependencies system, the ep_headings plugin won't add the dropdown list to the interface and so the ep_slideshows plugin is useless.

The solution is to install first ep_headings plugin, then ep_slideshows.

Is htere a way to tell the system to install the dependency plugin as a plugin (and not a subplugin) if, ie, this plugin doesn't exist yet in the system?

As far as I understood the principles behind npm, it can't be done.

So, the plugin creator has no choice other than explaining in the description of the plugin that the dependency has to be installed first.

And that doesn't seem right.


@redhog how did you plan for us to deal with this? Afaik peerDependencies are the way forward..

RE "the ep_headings plugin won't add the dropdown list to the interface and so the ep_slideshows plugin is useless." Why wont it? It should be fine...


#6565 pressed the reset button on how peerDependencies work for npm@3, and the new behavior is much simpler: if you want a thing installed, put it in dependencies; if a package needs a peer, add it to peerDependencies, where it will warn instead of erroring when said peerDependencies are missing. This is slightly different from what's discussed here, but the new behavior is sufficiently different that I think it justifies closing this issue as either resolved or rendered irrelevant. Thanks to all for their time and patience!

@othiym23 othiym23 closed this Apr 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment