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

require way of accessing this library doesn't work. #96

Closed
GouthamShiv opened this issue Mar 20, 2024 · 2 comments · Fixed by #97 or #98
Closed

require way of accessing this library doesn't work. #96

GouthamShiv opened this issue Mar 20, 2024 · 2 comments · Fixed by #97 or #98
Assignees

Comments

@GouthamShiv
Copy link

Using the latest version 2.0.2 and the require way of using the library is not working.

const Client = require('@ibm-generative-ai/node-sdk').Client

  - stack trace: Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/my_app/node_modules/p-queue/dist/index.js from /Users/my_app/node_modules/@ibm-generative-ai/node-sdk/dist/index.cjs not supported.
Instead change the require of index.js in /Users/my_app/node_modules/@ibm-generative-ai/node-sdk/dist/index.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/my_app/node_modules/@ibm-generative-ai/node-sdk/dist/index.cjs:230:30)
    at Object.<anonymous> (/Users/my_app/watsonx/promptLLM.js:10:16)
    at Object.<anonymous> (/Users/my_app/routes/genai_service.js:39:24)
    at /Users/my_app/node_modules/bhendi/mw/dispatcher.js:193:47
    at async Promise.all (index 2)
    at async /Users/my_app/node_modules/bhendi/mw/dispatcher.js:123:13
    at async Promise.all (index 0)
    at async /Users/my_app/node_modules/bhendi/mw/dispatcher.js:109:9
    at async Promise.all (index 0)
    at async Object.registerRoutes (/Users/my_app/node_modules/bhendi/mw/dispatcher.js:72:5)
    at async Object.init (/Users/my_app/node_modules/bhendi/bhendi.js:471:20)
    at async startServer (/Users/my_app/app.js:66:25)

Thanks!

@pilartomas
Copy link
Collaborator

Thank you for the report! Please try the latest release 2.0.4, the issue should be fixed there.

@GouthamShiv
Copy link
Author

Works now! Thanks for the fix 👍🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants