dropbox / dropbox-sdk-js

The Official Dropbox API V2 SDK for Javascript
https://www.dropbox.com/developers
MIT License
941 stars 352 forks source link

Example does not work #1113

Open LouiseEH opened 1 year ago

LouiseEH commented 1 year ago

Describe the bug I am using the simple example with the client secret, but I get the following error: Error [ERR_REQUIRE_ESM]: require() of ES Module /src/lib/dropbox/dropbox-api.js not supported. Instead change the require of index.js in /src/lib/dropbox/dropbox-api.js to a dynamic import() which is available in all CommonJS modules.

To Reproduce Use the simple example with the client secret

Expected Behavior The example should produce an oauth token

Actual Behavior An error occurs as described above on npm run dev

Screenshots N/A

Versions

Additional context N/A

LouiseEH commented 1 year ago

Using:

const fetch = require('isomorphic-fetch')

seems to work

greg-db commented 1 year ago

Can you elaborate on exactly what you're running and how? For instance, are you referring to this examples/javascript/simple-backend sample in particular? Please share the full steps and commands you're following to reproduce the issue you're seeing.

Also, what version of Node are you using?

Thanks!