Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

kurento-client-core: Cannot find module 'async' #624

Open

Description

@joeflateau

Prerequisites

These are MANDATORY, otherwise the issue will be automatically closed.

Issue description

kurento-client depends on kurento-client-core which depends on the module async. However, since many modules may depend on async and very few others will depend on kurento-client-core you will often find yourself in a situation where async is installed in the kurent-client directory rather than your app's node_modules and kurento-client-core will not be able to import it properly.

node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'async'
Require stack:
- /var/my-app/node_modules/kurento-client-core/lib/abstracts/MediaElement.js
- /var/my-app/node_modules/kurento-client-core/lib/HubPort.js
- /var/my-app/node_modules/kurento-client-core/lib/index.js
- /var/my-app/node_modules/kurento-client/lib/KurentoClient.js
- /var/my-app/node_modules/kurento-client/lib/index.js
- /var/my-app/main.js

Context

How to reproduce?

Create a project and install both portfinder and kurento-client-core which require different versions of async. You will likely end up with a node_modules that looks like this:

my_app/node_modules/
  - kurento-client
    - async
  - kurento-client-core
  - portfinder
    - async

When kurento-client-core attempts to require("async") it will not be found.

Expected & current behavior

(Optional) Possible solution

kurento-client-core package.json should declare its dependency on async (or async should no longer be depended on)

Info about your environment

kurento-client: 6.16.0
npm: 8.8.0

About Kurento Media Server

About your Application Server

  • Programming Language: node
  • Kurento Client version: 6.16.0

About end-user clients

  • Device(s):
  • OS(es):
  • Browser(s):

Run these commands

cat /etc/lsb-release
kurento-media-server --version
dpkg -l | grep -Pi 'kurento|kms-|gst.*1.5|nice'

Activity

  1. github-actions commented on May 4, 2022

    @github-actions

    Hello @joeflateau! 👋 we're sorry you found a bug... so first of all, thank you very much for reporting it.

    To know about progress, check in Triage. All issues are considered Backlog Candidates until work priorities align and the issue is selected for development. It will then become part of our official Backlog.

  2. joeflateau commented on May 5, 2022

    @joeflateau
    Author

    async is one example but the real issue is that kurento-client-core doesn’t declare its dependencies and just expects to be able to use the dependencies of kurento-client. So I expect if the async module dependency is removed then another dependency will have the same issue.

  3. joeflateau commented on May 5, 2022

    @joeflateau
    Author

    I tried looking through kurento-client-js and kms-core to see how the kurento-client-core package.json is generated to see about sending a PR to make sure the dependencies are preserved in the kurento-client-core but I wasn't able to decipher how that's actually generated.

  4. j1elo commented on May 5, 2022

    @j1elo
    Member

    I've been looking into it too, to reply here, here's the gist of it:

    This model_package_json.ftl is the template used for all package.json files of all modules; both the ones part of Kurento, and any extra module that might be created by an user.

    I agree that this template is lacking some kind of list that can be used by each module to specify their dependencies. Such list would be used by the template to inject them into the dependencies array in the resulting package.json... but having a look at it, seems nothing to that effect is present.

    I guess that's why the original developers decided it was much easier to just add the dependencies to the JavaScript client library, instead of the specific internal components such as kurento-client-core-js.

  5. added
    known-issues
    on Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    known-issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions