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.
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.
You seem pretty confused on how peer dependencies are supposed to work. Have you read http://domenic.me/2013/02/08/peer-dependencies/ ?
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 nodejs.org (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 (https://npmjs.org/package/ep_slideshow) that requires ep_heading
(the problem was exactly the same when I installed the plugin ep_list_pads (https://npmjs.org/package/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 https://registry.npmjs.org/ep_slideshow
npm http 200 https://registry.npmjs.org/ep_slideshow
npm http GET https://registry.npmjs.org/ep_slideshow/-/ep_slideshow-0.1.9.tgz
npm http 200 https://registry.npmjs.org/ep_slideshow/-/ep_slideshow-0.1.9.tgz
npm http GET https://registry.npmjs.org/ep_headings
npm http 304 https://registry.npmjs.org/ep_headings
npm WARN package.json firstname.lastname@example.org No README.md file found!
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'
npm uninstall ep_headings
npm WARN uninstall not installed in /home/etherpad/etherpad-lite/node_modules: "ep_headings"
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.
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 (http://blog.nodejs.org/2013/02/07/peer-dependencies/)
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.
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!