pingdotgg/uploadthing

[bug]: ERR_PACKAGE_PATH_NOT_EXPORTED UploadthingV7

Closed this issue ยท 2 comments

Provide environment information

System:
    OS: Windows 11 Pro 23H2
    CPU: AMD Ryzen 7 5700G with Radeon Graphics @ 3.80 GHz
    Memory: 16.0 GB (15.9 GB usable)
    GPU: NVIDIA GTX RTX 4080

  Binaries:
    Node: v20.15.0
    Bun: 1.1.26 
    npm: 10.7.0 

  Browsers:
    Brave Browser: 119.1.60.110
    Chrome: 128.0.6613.139 (Official Build) (64-bit)
    Edge: 128.0.2739.67
    Safari: 17.6
  npm packages:
    "@uploadthing/svelte": "^7.0.2"
    "typescript": "^5.0.0",
    "vite": "^5.0.3"
    "svelte": "^4.2.7",
    "@sveltejs/kit": "^2.5.26",
    "uploadthing": "^7.0.2",

Describe the bug

When I migrated to the v7 uploadthing version and reinstalled the uploadthing binaries with bun add uploadthing @uploadthing/svelte I got the following stack trace when I restarted the development server:

Error when evaluating SSR module /node_modules/@uploadthing/svelte/dist/create-uploadthing.js: failed to import "@uploadthing/shared"
|- Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './audio' is not defined by "exports" in C:\Users\cliffordkleinsr\Documents\Clido_Projects\svelte\turso\node_modules\@uploadthing\shared\node_modules\@uploadthing\mime-types\package.json imported from C:\Users\cliffordkleinsr\Documents\Clido_Projects\svelte\turso\node_modules\@uploadthing\shared\dist\index.js
    at exportsNotFound (node:internal/modules/esm/resolve:304:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:651:9)
    at packageResolve (node:internal/modules/esm/resolve:837:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:36)
    

Link to reproduction

N/A

To reproduce

Install the latest binaries with: bun add uploadthing @uploadthing/svelte on a fresh Sveltekit project

Additional information

The only remedy is to to downgrade to legacy v6 packages in this case run:
bun add uploadthing@6.13.3 @uploadthing/svelte@6.7.0

๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributing

  • ๐Ÿ™‹โ€โ™‚๏ธ Yes, I'd be down to file a PR fixing this bug!

Code of Conduct

  • I agree to follow this project's Code of Conduct

It seems like you have some bad cache state as this was fixed in 7.0.1. Try clearing node modules, perhaps even reset the Bun cache (I know bun caches heeeavily)

Can confirm clearing bun.lockb and node-modules directory fixes the issue even on the production branch. Many thanks @juliusmarminge