Package import specifier "#build/nuxt.config.mjs" is not defined in package

Hey. I'm getting this error when using a specific package, but the error is not pointing to that package specifically, but I'm guessing a dependency of that package. Is there something I can do to resolve this issue?
[nuxt] [request error] [unhandled] [500]
Package import specifier "#build/nuxt.config.mjs" is not defined in package
(..)\node_modules\.pnpm\[email protected]_@parcel+watcher_457772fc42dce1c644abf364550320ea\node_modules\nuxt\package.json
imported from
(..)\node_modules\.pnpm\[email protected]_@parcel+watcher_457772fc42dce1c644abf364550320ea\node_modules\nuxt\dist\app\nuxt.js
[nuxt] [request error] [unhandled] [500]
Package import specifier "#build/nuxt.config.mjs" is not defined in package
(..)\node_modules\.pnpm\[email protected]_@parcel+watcher_457772fc42dce1c644abf364550320ea\node_modules\nuxt\package.json
imported from
(..)\node_modules\.pnpm\[email protected]_@parcel+watcher_457772fc42dce1c644abf364550320ea\node_modules\nuxt\dist\app\nuxt.js
7 Replies
kapa.ai
kapa.ai4w ago
Hi @ægteemil. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, this issue appears to be related to a recent update in Nuxt 3.15.x. The error you're encountering is likely due to a problem with resolving imports in the new version of Nuxt. Here are a few potential solutions you can try: 1. Update to the latest version of Nuxt: Make sure you're using the latest version of Nuxt, as this issue might have been resolved in a recent patch. You can update by running:
npm update nuxt

npm update nuxt

or if you're using pnpm:
pnpm update nuxt

pnpm update nuxt

2. Clear the cache: As suggested in this GitHub issue comment, you can try removing the Vite cache:
rm -rf node_modules/.cache/vite

rm -rf node_modules/.cache/vite

3. Configure Vite SSR: As mentioned in this GitHub comment, you can try configuring vite.ssr.noExternal in your nuxt.config.ts:
export default defineNuxtConfig({
vite: {
ssr: {
noExternal: ['package-name-causing-issue']
}
}
})

export default defineNuxtConfig({
vite: {
ssr: {
noExternal: ['package-name-causing-issue']
}
}
})

Replace 'package-name-causing-issue' with the name of the package you suspect is causing the problem. 4. Disable app manifest: As a workaround, you can try disabling the app manifest in your nuxt.config.ts:
export default defineNuxtConfig({
experimental: { appManifest: false },
})

export default defineNuxtConfig({
experimental: { appManifest: false },
})

If none of these solutions work, you may need to wait for a fix in the next Nuxt patch release. In the meantime, you could consider temporarily downgrading to a previous version of Nuxt where this issue didn't occur. If the problem persists, it would be helpful to create a minimal reproduction of the issue and report it on the Nuxt GitHub repository. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4w ago
<@230357473389838336> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
/home/liam
/home/liam3w ago
@ægteemil any luck figuring this issue out? running into the exact same issue.
ægteemil
ægteemilOP3w ago
nope, no clue. do you know which package you're using that's causing this?
/home/liam
/home/liam3w ago
not sure. the only modules I have loaded are nuxt ui and nuxt ui pro, though it’s kind of hard to tell if they are the cause, because I can’t really temporarily remove them.
ægteemil
ægteemilOP3w ago
i figured out which package caused it, or at least i think i did. was this one https://heyapi.dev/openapi-ts/clients/nuxt still have no clue why though
/home/liam
/home/liam3w ago
huh... I use that too. ok, maybe I will rollback the version I'm pulling in and see if I can find one that worked, as I definitely had a functional version of the new openapi-ts nuxt client after the initial release...

Did you find this page helpful?