Closed robhowe-A closed 3 months ago
The error looks a lot like something is trying to use ESM style code in CommonJS environment.
I'm not familar with gulp, but the pubished @ibm-cloud/cloudant
has been used with both CommonJS
and ESM
module styles and with both TS and JS in Node without this error so I don't think this is a problem with the library/dependencies.
I'm using the SDK Typescript test to create a database and populate
I'm not sure exactly which code "SDK Typescript test" is referring to here, but if you are copy/pasting any of our TS examples then you likely need a gulpfile.ts
with ts-node
rather than a gulpfile.js
. If you don't want/need TS you can just use JS - we have some examples in the README in both formats (the JS twisties are collapsed by default).
Install cloudant in Gulp + Typescript environment
What module system are you trying to use though? Do you have a module
entry in your package.json
? If you are using typescript and transpiling then what tsconfig
settings are you using? Did you try gulpfile.mjs
or gulpfile.cjs
to force use of a specific module system (or the equivalent ~mts
~ [edit looks like mts
is unsupported] and cts
for TS). It looks like gulp support for TS and ESM might be a little awkward.
I'm closing this as stale. Please comment with additional information if you want to re-open (or feel free to share if you found a solution to the problem). Thanks.
Describe the bug I'm using the SDK Typescript test to create a database and populate. I have Gulp + Typescript developer space. I get stopped at a compile error referring axios.js. I've tried multiple fixes from website searches and playing with the source/package files of axios. I did not try downgrading axios, which was one of the search solutions, as it would not be the newest version.
To Reproduce Install cloudant in Gulp + Typescript environment
Expected behavior It is expected the dependency agrees to module use cases.
Screenshots
Output
Must gather (please complete the following information): Node v20.13.1 ibm-cloud-sdk-core@4.3.0 axios@1.7.2
Additional context No solution found of Javascript or Typescript.