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

Transitive dependencies not listed when AdapterJS used as direct dependency #262

Closed
NTARelix opened this issue Apr 5, 2017 · 1 comment

Comments

@NTARelix
Copy link
Contributor

NTARelix commented Apr 5, 2017

When adapterjs is a dependency of package mypackage and you attempt to view the dependencies of mypackage, none of the transitive dependencies installed by adapterjs show up in the dependency tree given by npm ls with respect to mypackage.

To demonstrate

  1. Create new package: $ mkdir mypackage && cd mypackage && npm init -y
  2. Install adapterjs as dependency: $ npm i -S adapterjs
  3. List all dependencies installed for mypackage: $ npm ls
    [email protected] /Users/ntarelix/mypackage
    └── [email protected]
    
  4. List all dependencies installed for adapterjs: $ cd node_modules/adapterjs/third_party/adapter/ && npm ls
    [email protected] /Users/ntarelix/mypackage/node_modules/adapterjs/third_party/adapter
    ├─┬ [email protected]
    │ ├── [email protected]
    │ ├── [email protected]
    │ ├─┬ [email protected]
    │ │ └── [email protected]
    │ └── [email protected]
    ├── [email protected]
    ├─┬ [email protected]
    │ ├── [email protected]
    ...
    

Notice how a lot more than just adapterjs was installed, but npm was unable to pick up on these dependencies because they were not listed as dependencies of adapterjs. It happens because adapterjs's package.json has a postinstall script that installs a submodule, webrtc-adapter.

This is problematic for a number of reasons. My particular problem comes from the setup of a private npm registry where I'm publishing all of my project's dependencies on a Nexus server semi-manually. I use npm ls to list all my dependencies and use that list to manually publish each listed version of each package individually. If they aren't listed with npm ls then they don't get published and cannot be installed by other packages later. This means adapterjs can't be installed using exclusively my private registry unless I npm ls from webrtc-adapter and also publish each of those dependencies.

Some other problems that I believe are also caused by this:

To solve this I believe it would be best to remove the postinstall script so nothing additional gets installed and because the distributables are already included when I npm i adapterjs. Not sure what the best practice alternative would be, but maybe putting it in a dev script and adding 1 more step to dev setup would be good enough.

@NTARelix
Copy link
Contributor Author

Fixed in pull request: 9ebafbe

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

1 participant