Can't resolve 'p-queue' in '@uppy/provider-views/lib/ProviderView'

Hi, recently I upgraded the Uppy package (core, dashboard, and plugins) versions to the latest ones.
And the webpack complains about the missing module named ‘p-queue’.

ERROR in ./node_modules/@uppy/provider-views/lib/ProviderView/ProviderView.js
Module not found: Error: Can't resolve 'p-queue' in 'node_modules/@uppy/provider-views/lib/ProviderView'
 @ ./node_modules/@uppy/provider-views/lib/ProviderView/ProviderView.js 57:0-29 561:48-54
 @ ./node_modules/@uppy/provider-views/lib/ProviderView/index.js
 @ ./node_modules/@uppy/provider-views/lib/index.js
 @ ./node_modules/@uppy/onedrive/lib/OneDrive.js
 @ ./node_modules/@uppy/onedrive/lib/index.js
 @ ./app/javascript/common/uppy_activestorage.js

Please let me know the solution.
Should I downgrade the uppy package versions back?
Thanks.

1 Like

I also have this error, what version you were using before? I just signed up on transloadit and was trying to integrate Companion on my application. And whenever I try to use the plugins for any external source I get this error.

I think it’s because the p-queue dependencie became a pure ESM package and in some cases your bundler don’t know what to do with it.

My current setup is
node: v14.16.0
webpack-dev-server: 3.11.0

Related links

I was using pretty old versions which seems not depending on ‘p-queue’ package.
@uppy/aws-s3”: “^1.5.2”,
@uppy/core”: “^1.7.1”,
@uppy/dashboard”: “^1.6.2”,
@uppy/dropbox”: “^1.3.8”,
@uppy/google-drive”: “^1.4.2”,
@uppy/onedrive”: “^1.0.2”,
@uppy/url”: “^1.4.5”,
@uppy/utils”: “^2.2.2”,
@uppy/xhr-upload”: “^1.5.2”,

My current versions are:
@uppy/aws-s3”: “^3.2.0”,
@uppy/box”: “^2.1.1”,
@uppy/core”: “^3.2.1”,
@uppy/dashboard”: “^3.4.1”,
@uppy/dropbox”: “^3.1.1”,
@uppy/google-drive”: “^3.1.1”,
@uppy/onedrive”: “^3.1.1”,
@uppy/url”: “^3.3.2”,
@uppy/utils”: “^5.4.0”,
@uppy/xhr-upload”: “^3.3.0”,

Thanks.

Maybe you need to set "type": "module" in your package.json

@mifi no such line in my package.json file.

Related: wrong import for version 7 by shivanshu-tomar · Pull Request #4530 · transloadit/uppy · GitHub

These reports are surprising to me, our CI is checking that bundling Uppy with latest Webpack works as expected, maybe it’s a bug with the version of Webpack you are using? Have you tried upgrading it?

Hi! Yeah, in my case we are usign an old version of webpack. I’ll try to update it to see if that fixes the issue. These are the versions we are using.

"webpack": "^4.29.6",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"

I modified the way you import p-queue in

//node_modules/@uppy/provider-views/lib/ProviderView/ProviderView.js

// From
import PQueue from 'p-queue';
// To
import PQueue from 'p-queue/dist';

And that seems to make work with my current setup. But now whenever I open Uppy and select a remote source I get a message that says “Connection with Companion failed”. That only happens when you haven’t authenticated with that source. Once you authenticate that message dissapears for that source.
Example

Is that normal? It could be becasue I’m testing from localhost? The companion url is configured as the docs in Uppy says.

import Uppy from '@uppy/core';
import Dashboard from '@uppy/dashboard';
import RemoteSources from '@uppy/remote-sources';
import Transloadit, {
    COMPANION_URL,
    COMPANION_ALLOWED_HOSTS,
} from '@uppy/transloadit';

... 

const uppy = new Uppy({
  restrictions: {
    maxNumberOfFiles: 3,
    minNumberOfFiles: 1,
    allowedFileTypes: ['image/jpeg', 'image/jpg', 'image/png']
  }
})
.use(Dashboard, {
  id: 'Dashboard',
  closeAfterFinish: true,
  closeModalOnClickOutside: true
})
.use(RemoteSources, {
  target: Dashboard,
  companionUrl: COMPANION_URL,
  companionAllowedHosts: COMPANION_ALLOWED_HOSTS,
})
.use(Transloadit, {
  assemblyOptions: {
    params: {
      auth: { key: 'auth_key' },
      template_id: 'temp_id',
    },
  },
});

To anyone still struggling with this p-queue error I can confirm this get fixed by updating your project to the latest webpack version! I just upgrade my Ruby on Rails project from webpacker 5.2.1 to 6.0.0-rc.6 which use the latest webpack version 5.88.2 and now everything loads fine. Even the companion connection error dissapeared. :raised_hands:

If anyone else is struggling with this and has an RoR project with an old version of webpack like me you can follow this upgrading guide from guys from shakacode, now everything’s work fine but will consider to upgrade to shakapacker v6 using this same guide since webpacker is officially retired.