question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot import from `nuxt/app` (Package import specifier "#build/app.config.mjs" is not defined)

See original GitHub issue

Environment

Operating System: MacOS Ventura Node Version: v16.13.0. Nuxt Version: 3.0.0-rc.9 Nitro Version: 0.5.0 Package Manager: yarn@1.22.19 Builder: webpack ( I think) User Config: Runtime Modules: “dependencies”: { “@formkit/i18n”: “^1.0.0-beta.10”, “@pinia/nuxt”: “^0.4.1”, “axios”: “^0.27.2”, “pinia”: “^2.0.21”, “pinia-plugin-persistedstate”: “^2.1.1”, “postmark”: “^3.0.1”, “swiper”: “^8.3.1”, “vue3-marquee”: “^3.0.7” } Build Modules: “devDependencies”: { “@aceforth/nuxt-netlify”: “^1.1.0”, “@formkit/nuxt”: “^1.0.0-beta.11-0dd967c”, “@iconify-json/heroicons-solid”: “^1.1.1”, “@nuxtjs/tailwindcss”: “^5.3.2”, “@tailwindcss/typography”: “^0.5.7”, “@vueuse/core”: “^9.1.1”, “@vueuse/nuxt”: “^9.1.1”, “netlify-cli”: “^11.5.1”, “nuxt”: “3.0.0-rc.9”, “unplugin-icons”: “^0.14.5” }

Reproduction

I upgrade with yarn upgrade and with yarn upgrade nuxt, then yarn upgrade --force, and then yarn upgrade --latest. I upgraded to RC.9 and a few packages that didn’t work I upgraded manually to the edge repository like formkit that needed yarn add @formkit/nuxt@next --dev .

I’will try to make a minimal reproduction, but as the project has many pages and components Im not sure if I have to recreate the whole project.

Describe the bug

When I do yarn build -> the site is completely broken it doesn’t load any page. When I do yarn dev -> the site works ok When I do yarn check -> There is 1 error

error "@pinia/nuxt#unctx#unplugin#vite@^2.3.0" doesn't satisfy found match of "vite@3.0.9"
error Found 1 errors.

Additional context

No response

Logs

[nuxt] [request error] [unhandled] [500] Package import specifier "#build/app.config.mjs" is not defined in package /Users/david/WebstormProjects/mixverde/.output/server/node_modules/nuxt/package.json imported from /Users/david/WebstormProjects/mixverde/.output/server/node_modules/nuxt/dist/app/config.mjs
  at new NodeError (node:internal/errors:371:5)  
  at throwImportNotDefined (node:internal/modules/esm/resolve:429:9)  
  at packageImportsResolve (node:internal/modules/esm/resolve:778:3)  
  at moduleResolve (node:internal/modules/esm/resolve:924:21)  
  at defaultResolve (node:internal/modules/esm/resolve:1044:11)  
  at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)  
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)  
  at link (node:internal/modules/esm/module_job:75:36)```

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:35 (12 by maintainers)

github_iconTop GitHub Comments

8reactions
danielroecommented, Sep 6, 2022

Please ensure you are not importing directly from nuxt/app but from #imports.

5reactions
Lyokoluxcommented, Sep 6, 2022

I bumped my dependency and I am facing this issue with histoire.

I get: TypeError [ERR_PACKAGE_IMPORT_NOT_DEFINED]: Package import specifier "#build/app.config.mjs" is not defined in package node_modules/nuxt/package.json imported from node_modules/nuxt/dist/app/config.mjs

The line in question is: import __appConfig from "#build/app.config.mjs";

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt 3 package import specifier "#internal/nitro" is not defined
I tried installing the new version of Nuxt.js with command: npx nuxi init nuxt-app.
Read more >
Renovate Bot Package Diff
nuxtApp.hooks. ... import AppComponent from "#build/app-component.mjs"; ... extractObject(code.slice(index + match.length)) : "undefined";.
Read more >
ES Modules · Nuxt Concepts
This guide helps explain what ES Modules are and how to make a Nuxt app (or ... However, if you try to import...
Read more >
[nuxt] [request error] require is not defined in es module scope ...
But you cant use import and require() at the same time, it does not work. You either use require() or import And, your...
Read more >
Plugins directory - Nuxt
If you get an Cannot use import statement outside a module error, you may need to add your package to the build >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found