Installation problems

I have installed the @uppy/core^3.7.1 @uppy/dashboard @uppy/react library but when I go to run the application, I get errors when compiling in the @uppy/utils/lib/getDroppedFiles/index.js library files such as Unexpected reserved word of the await in the function: export default async function getDroppedFiles(dataTransfer, options)

 var _options$logDropError;
  // Get all files from all subdirs. Works (at least) in Chrome, Mozilla, and Safari
  const logDropError = (_options$logDropError = options == null ? void 0 : options.logDropError) != null ? _options$logDropError : Function.prototype;
  try {
    const accumulator = [];
    for await (const file of webkitGetAsEntryApi(dataTransfer, logDropError)) {
    return accumulator;
    // Otherwise just return all first-order files
  } catch {
    return fallbackApi(dataTransfer);

Hi, my hunch is that you’re running on old version of Node.js when compiling. This is not an issue we’ve seen anywhere.

Maybe not the version of Node.js, but the tool you’re using to bundle your JavaScript. FYI the async iterating (i.e. the use of for await in the function you mentioned) is an ES2018 feature, while async/await syntax is a ES2017 feature, so it’s possible you’re using a tool that don’t support ES2018, or is configured to not support it.

I think the problem is this. And would you know any way to solve it? Would I have to check the libraries that are incompatible with ES2018?

I don’t think that’s a thing, ES2018 is a superset of ES2017, which is a superset of ES2016, etc., meaning that libraries written for earlier versions of the spec still work just fine with more recent ones.

That’s hard to answer without knowing what tools you use, but the generic answer is to either configure your tools to parse the code as ES2018 or more, or to use a different tool.
You can ckeck out the Uppy repo, it has some examples of tested build tools along with their configuration.

Now I’m getting this error in that same function:
iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favour of array iterations.

It’s probably better to ask these questions on forums of the build tools or framework you use, because you are running into problems unrelated to Uppy. Perhaps ChatGPT might help you too.

1 Like