-
Notifications
You must be signed in to change notification settings - Fork 31
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
Error while Nordigen node client library on node version > 12.x : Must use import to load ES Module: /../node_modules/nordigen-node/lib/index.js require() of ES modules is not supported. #13
Comments
Hi. You should use As well you will need to add You can check |
Hi @victory-sokolov , Thanks for the quick reply, I followed the same approach as importing NordigenClient from "nordigen-node". I'am using nestJs and the code I write is in typescript. Hence the error that is being thrown is in the transpiled .js file, that I do not have any control over. Aslo about adding "type": "module" to package.json, on trying that I got an error as attached in the screenshot. |
If you want to use commonjs you can run the module through babel and it'll work. |
@praji1304 Could you please share your solution? I am still stuck on it. Also using NestJS. Thanks |
@jans-y did not find any solution that time at least, I ended up implementing the integration with their APIs. It will cost you a few hours but works perfectly fine. |
@praji1304 Thanks for the response. I did the same. Would be nice to either have it fixed or state this into docs as known limitation so devs don't waste their time on this issue ;) |
@deyceg Can you explain how to do it? |
Hello! Try something like this and let us know if this will works for you const nordigenNode = await import('nordigen-node');
const NordigenClient = nordigenNode.default;
const client = new NordigenClient({secretId: '', secretKey: ''}); |
I am using latest stable node version i.e 16.14.2, I get below mentioned error on compiling the code.
const nordigen_node_1 = require("nordigen-node");
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/polyscripts/polyscripts/payments-backend/node_modules/nordigen-node/lib/index.js from /home/../dist/nordigen/nordigen.controller.js not supported.
Instead change the require of index.js in /home/../dist/nordigen/nordigen.controller.js to a dynamic import() which is available in all CommonJS modules.
The text was updated successfully, but these errors were encountered: