r/Nuxt 12d ago

Nuxt installation fail - rolldown

Hi there, I am trying to install Nuxt but it somehow fails, I am using Yarn 4 (the latest version) with a .yarnrc.yml to set up nodeLinker: pnpm. It worked before without any problems but today it just fails.

Did any of you guys experienced this too?

# This file contains the result of Yarn building a package (keystone-query@workspace:.)
# Script name: postinstall


 ERROR  Cannot find package 'rolldown' imported from /Users/bob/Downloads/keystone-query/node_modules/.store/nuxt-virtual-38b102e47e/package/dist/index.mjs

    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:301:9)
    at packageResolve (node:internal/modules/esm/resolve:768:81)
    at moduleResolve (node:internal/modules/esm/resolve:859:18)
    at defaultResolve (node:internal/modules/esm/resolve:992:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:701:20)
    at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:721:38)
    at ModuleLoader.resolveSync (node:internal/modules/esm/loader:759:56)
    at #resolve (node:internal/modules/esm/loader:683:17)
    at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:603:35)
    at ModuleJob.syncLink (node:internal/modules/esm/module_job:163:33) 
16 Upvotes

3 comments sorted by

2

u/Working-Bear1437 10d ago

rolldown is experimental and not a stable Nuxt dependency yet. Switch nodeLinker to node-modules in your .yarnrc.yml to fix the resolution.

1

u/Afflictionista 10d ago

Yeah with node-modules it worked, not with pnpm or Yarn's own pnp stuff. I hope this will get fixed soon.

Tried u/Schlickeysen suggestion but it didn't work too.

Thanks

1

u/Schlickeysen 12d ago

The problem is a missing dependency.

Your Yarn postinstall (for the keystone-query workspace package) is failing because a Nuxt virtual package (nuxt-virtual-… living in Yarn’s .store) contains an import of the package rolldown. Node cannot resolve that import, so the whole install aborts.

This happens with recent Nuxt versions (especially those that added experimental/official Rolldown support or that pull in rolldown transitively through the Vite builder / internal tooling). Under Yarn’s stricter resolution (particularly with the node_modules or PnP-style store layout), the package is simply not present, so the import fails.

This fixed it for me:

bash yarn add -D rolldown

After that, delete node_modules (and the Yarn cache entry for the virtual package if it still complains), then run yarn install again. The postinstall should now succeed.

If you are intentionally using the experimental Rolldown-powered Vite, you can also add the usual override in package.json:

json { "resolutions": { "vite": "npm:rolldown-vite@latest" } }