core icon indicating copy to clipboard operation
core copied to clipboard

Deployment fails with "Could not load /Users/user/Nuxt/app/node_modules/unenv/runtime/npm/mime.mjs" error

Open aerrata opened this issue 11 months ago • 4 comments

Describe the bug

On a fresh nuxt project with nuxthub module installed, I'm getting this error when deploying;

[nitro 8:49:15 AM]  ERROR  Error: Could not load /Users/user/Nuxt/app/node_modules/unenv/runtime/npm/mime.mjs (imported by node_modules/@nuxthub/core/dist/runtime/blob/server/utils/blob.js): ENOENT: no such file or directory, open '/Users/user/Nuxt/app/node_modules/unenv/runtime/npm/mime.mjs'

The file /Users/user/Nuxt/imagene/node_modules/unenv/runtime/npm/mime.mjs is missing.

It appears that the unenv package was upgraded from version 1.10.0 to 2.0.0-rc.0 when I ran npx nuxthub deploy, resulting in changes to the package structure.

Or am I missing something here? Thanks.

Steps to reproduce

  1. Install nuxthub module on a fresh install nuxt, run;
npx nuxthub deploy
  1. Deployment will fail with the error above

Nuxt info

  • Operating System: Darwin
  • Node Version: v20.16.0
  • Nuxt Version: 3.15.2
  • CLI Version: 3.20.0
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules
  • Runtime Modules: @nuxthub/[email protected]
  • Build Modules: -

aerrata avatar Jan 24 '25 01:01 aerrata

Do you have a sharable reproduction? 🙏🏼

pi0 avatar Jan 24 '25 10:01 pi0

Do you have a sharable reproduction? 🙏🏼

I have a Stackblitz link, but I can't login to the NuxtHub, might not be helpful I think. 😅

Btw, after some debugging, here is what i found;

I'm using bun currently, seems like bun add --dev wrangler upgrades the unenv package from 1.10.0 to 2.0.0-rc.0, causing the deploy error

Then, using npm, I deploy a fresh nuxt project with nuxthub module and wrangler installed, the error is gone.

So this might be an issue with bun maybe?

aerrata avatar Jan 24 '25 16:01 aerrata

I had the same error and was able to temporarily fix it by overriding the unenv version in package.json:

"resolutions": {
  "unenv": "1.10.0"
}

Xfox20 avatar Feb 14 '25 11:02 Xfox20

Are you still experiencing this issue on a fresh project?

RihanArfan avatar Apr 15 '25 01:04 RihanArfan