APIv3-nodejs-library: Module not found: Can't resolve 'ApiClient' in ...\node_modules\sib-api-v3-sdk\src'
Following the basic instructions, after running npm install sib-api-v3-sdk --save
and then pasting in `var SibApiV3Sdk = require(‘sib-api-v3-sdk’);
var defaultClient = SibApiV3Sdk.ApiClient.instance;` I get the error mentioned in the title. It seems to me like this is an error within the API, but I could also be doing something wrong. Does anyone have any suggestions?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 33
This is a perfect example of how you lose customers.
I invested some time in trying to make this work and gave up. I am now just using
fetch
with a POST requestHaving issue relating to this
The official fix seems to be “please patch your whole build process to spit CJS modules” (which you might not want to do your codebase is somewhat modern).
Using the fetch API with the right headers instead is definitely more effective (see link).
Based on style, I’m pretty sure the authors of the library thought “java” in javascript stood for Java the language.
Want a PR on how to expose a lib for multiple modules systems ?
Same issue on MacOS (M1) 12.4 , Node 16.14.2 Gave up and used something else instead.
Hey @EricHasegawa I tried to replicate the error that you are facing but could not do it with the following steps:
var SibApiV3Sdk = require('sib-api-v3-sdk'); var defaultClient = SibApiV3Sdk.ApiClient.instance;
npm install sib-api-v3-sdk --save
{ "name": "testwrappers", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": {}, "devDependencies": { "sib-api-v3-sdk": "^8.2.0" } }
It looks like the dependencies were not correctly installed. Can you please try to remove the
node_modules
folder and then install the dependencies again? Do let me know if you face any issues.Hi @laubonghaudoi Sorry to hear we could not help you with this. The reason is that we were not able to reproduce this issue in any way we tried.
We do have our new SDKs mainly with the replacement of
api.sendinblue.com
domain withapi.brevo.com
domain. If you want you can try them out as here:closing because its been a couple years lol
HI @yaron1m Unfortunately, I haven’t been able to replicate this issue at our end. Can you help us with steps on how to replicate it or how you are trying to use it? Also, FYI we are using the latest version of this wrapper inside SIB internal projects and it is working fine. Thanks!
Hey I will work on it and try to reproduce it at our end.
Same issue here, I already try installing modules again!