N
Nuxt3d ago
Zachary

Errors installing `@nuxtjs` modules

Hey Nuxters! Pretty new to Nuxt & Vue, coming from a React primary experience. But I am pretty stuck on these errors, and not finding much information about the package or errors in general, on Google, Nuxt GitHub, and even the module repo's I'm installing... So hoping someong might be able to help me out here. 🙏 I have setup my project with Nuxt 4, Tailwind CSS (@tailwindcss/vite), and shadcn-nuxt. All three seem to be working well together. I have been trying to install two packages, at first I was just trying @nuxtjs/color-mode with no luck, I was just thinking it could be that package, but then trying to install @nuxtjs/google-fonts, I am given the same error... When I install them they return the error, and when I keep them installed and run the dev server (bun run dev), I'm returned the error again and it won't start until the packages are removed. Here is the error I receive when I try to install either: - Installing
@Zachary ➜ ~\ukiyo git(main) bun add -D @nuxtjs/google-fonts
bun add v1.2.18-canary.65 (6d03bdfc)

$ nuxt prepare

WARN Module error: Invalid module "app\components\ui\date-picker\index" is not a valid package name imported from C:\Users\Zachary\ukiyo\ 10:20:51 pm


ERROR The requested module 'pathe/utils' does not provide an export named 'reverseResolveAlias' 10:20:52 pm

import { resolveAlias as resolveAlias$1, reverseResolveAlias } from 'pathe/utils';
^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'pathe/utils' does not provide an export named 'reverseResolveAlias'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:485:26)
at async normalizedModule (/C:/Users/Zachary/ukiyo/node_modules/@nuxt/devtools/node_modules/@nuxt/kit/dist/index.mjs:2169:17)
at async installModule (/C:/Users/Zachary/ukiyo/node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:499:202)
at async initNuxt (/C:/Users/Zachary/ukiyo/node_modules/nuxt/dist/index.mjs:5651:5)
at async loadNuxt (/C:/Users/Zachary/ukiyo/node_modules/nuxt/dist/index.mjs:5858:5)
at async loadNuxt (/C:/Users/Zachary/ukiyo/node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:732:16)
at async Object.run (/C:/Users/Zachary/ukiyo/node_modules/@nuxt/cli/dist/chunks/prepare.mjs:32:18)
at async runCommand (/C:/Users/Zachary/ukiyo/node_modules/citty/dist/index.mjs:316:16)



ERROR The requested module 'pathe/utils' does not provide an export named 'reverseResolveAlias' 10:20:52 pm

error: postinstall script from "nuxt-app" exited with 1
@Zachary ➜ ~\ukiyo git(main) bun add -D @nuxtjs/google-fonts
bun add v1.2.18-canary.65 (6d03bdfc)

$ nuxt prepare

WARN Module error: Invalid module "app\components\ui\date-picker\index" is not a valid package name imported from C:\Users\Zachary\ukiyo\ 10:20:51 pm


ERROR The requested module 'pathe/utils' does not provide an export named 'reverseResolveAlias' 10:20:52 pm

import { resolveAlias as resolveAlias$1, reverseResolveAlias } from 'pathe/utils';
^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'pathe/utils' does not provide an export named 'reverseResolveAlias'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:485:26)
at async normalizedModule (/C:/Users/Zachary/ukiyo/node_modules/@nuxt/devtools/node_modules/@nuxt/kit/dist/index.mjs:2169:17)
at async installModule (/C:/Users/Zachary/ukiyo/node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:499:202)
at async initNuxt (/C:/Users/Zachary/ukiyo/node_modules/nuxt/dist/index.mjs:5651:5)
at async loadNuxt (/C:/Users/Zachary/ukiyo/node_modules/nuxt/dist/index.mjs:5858:5)
at async loadNuxt (/C:/Users/Zachary/ukiyo/node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:732:16)
at async Object.run (/C:/Users/Zachary/ukiyo/node_modules/@nuxt/cli/dist/chunks/prepare.mjs:32:18)
at async runCommand (/C:/Users/Zachary/ukiyo/node_modules/citty/dist/index.mjs:316:16)



ERROR The requested module 'pathe/utils' does not provide an export named 'reverseResolveAlias' 10:20:52 pm

error: postinstall script from "nuxt-app" exited with 1
This same error is returned when I run the development server. Thank you! :happys:
4 Replies
kapa.ai
kapa.ai3d ago
Hi @Zachary. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It looks like a tooling/version mismatch when Nuxt runs nuxt prepare (postinstall). Two related issues from the Nuxt repo and community point to: - Bun incompatibility: Several users hit dev/prepare errors on Bun 1.1.46+ and fixed them by either installing Node (so Bun can piggyback) or rolling back Bun to 1.1.45. After installing Node, dev server errors disappeared (either use Node directly or ensure Bun uses Node’s toolchain) (Nuxt dev server issues).
- Module resolution/kit changes in Nuxt 4: There were fixes in Nuxt Kit around resolving module paths and installModule behavior; mismatched versions across Nuxt/Kit/devtools can surface unexpected import errors during module install/prepare (fix(kit): use resolved module paths). What to try: 1) Use Node to run Nuxt (temporarily avoid Bun): - Install a current Node LTS. - Remove node_modules and lockfile, then reinstall with npm/pnpm/yarn. - Run npm run dev and retry adding @nuxtjs/color-mode or @nuxtjs/google-fonts.
(Users report this resolves the issue; Bun 1.1.45 or having Node installed helps) (Nuxt dev server issues). 2) Align Nuxt and modules: - Ensure you’re on a consistent Nuxt v4 and @nuxt/kit/devtools versions after a clean install (the kit PR indicates changes to module install internals that require matching versions) (fix(kit) PR). 3) Clean caches/build: - Delete node_modules, .nuxt, lockfile; clear package manager cache; reinstall. This helped others with similar unresolved imports after version bumps (v4.0.2 update thread). If after switching to Node and reinstalling you still see pathe/utils reverseResolveAlias errors, please share your Nuxt version, package manager and versions of @nuxt/kit and @nuxt/devtools to check for a known mismatch (the linked kit change suggests that out-of-sync dependencies can break prepare) (fix(kit) PR). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3d ago
<@138862213527109632> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
harlan
harlan3d ago
try run bun why pathe seems like a version resolution bug
Zachary
ZacharyOP3d ago
I did run the kapa.ai suggestion to just use npm, because honestly I didn't try that yet and figured I should if asking for support... Using npm did work last night and I was able to continue with what I was working on. I did just try the bun why pathe command but was returned the bun reserved subcommand error...
@Zachary ➜ ~\ukiyo git(main) bun why pathe
Uh-oh. bun why is a subcommand reserved for future use by Bun.

If you were trying to run a package.json script called why, use bun run why.
@Zachary ➜ ~\ukiyo git(main) bun why pathe
Uh-oh. bun why is a subcommand reserved for future use by Bun.

If you were trying to run a package.json script called why, use bun run why.
So I checked my bun version and was using 1.2.18. I've just upgraded to 1.2.22, and installing @nuxtjs/color-mode through bun works now. Not sure if using NPM last night fixed it, or upgrading bun after has fixed the issue. Thanks for your help! :)

Did you find this page helpful?