Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start project after creation (#internal/nitro/virtual/app-config is not defined) #2736

Open
manchenkoff opened this issue Jul 27, 2024 · 6 comments

Comments

@manchenkoff
Copy link

Environment

  • Operating System: Darwin
  • Node Version: v22.5.1
  • Nuxt Version: 3.12.4
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, modules, routeRules, compatibilityDate
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Reproduction

Create a new project using npx nuxi@latest init docs -t content with pnpm package manager and try to start dev server by running pnpm run dev.

Describe the bug

Once the dev server starts, there is an error that blocks website from loading, here are the details:

>>> pnpm run dev
> nuxt dev

Nuxt 3.12.4 with Nitro 2.9.7                                                                                                                                                          12:40:03 PM
                                                                                                                                                                                      12:40:04 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

  ➜ DevTools: press Shift + Option + D in the browser (v1.3.9)                                                                                                                        12:40:05 PM

✔ Vite client built in 55ms                                                                                                                                                          12:40:06 PM
✔ Vite server built in 263ms                                                                                                                                                         12:40:06 PM
✔ Nuxt Nitro server built in 460 ms                                                                                                                                            nitro 12:40:06 PM
ℹ Vite client warmed up in 0ms                                                                                                                                                       12:40:06 PM

[12:40:06 PM]  ERROR  [worker reload] [worker init] Package import specifier "#internal/nitro/virtual/app-config" is not defined in package /Users/manchenkoff/Dev/nuxt-laravel-echo/docs/node_modules/.pnpm/[email protected][email protected]/node_modules/nitropack/package.json imported from /Users/manchenkoff/Dev/nuxt-laravel-echo/docs/node_modules/.pnpm/[email protected][email protected]/node_modules/nitropack/dist/runtime/config.mjs

  at importNotDefined (node:internal/modules/esm/resolve:286:10)
  at packageImportsResolve (node:internal/modules/esm/resolve:736:9)
  at moduleResolve (node:internal/modules/esm/resolve:905:16)
  at defaultResolve (node:internal/modules/esm/resolve:1124:11)
  at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
  at ModuleLoader.resolve (node:internal/modules/esm/loader:526:25)
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
  at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

ℹ Vite server warmed up in 363ms

Additional context

Here is the package.json for the application (identical to the default Nuxt Content sample app)

{
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview"
  },
  "dependencies": {
    "@nuxt/content": "^2.13.1",
    "nuxt": "^3.12.4"
  }
}

Logs

No response

@manchenkoff manchenkoff changed the title Unable to start project after creation Unable to start project after creation (#internal/nitro/virtual/app-config is not defined) Jul 27, 2024
s1gr1d added a commit to getsentry/sentry-javascript that referenced this issue Aug 2, 2024
Reverting the change in this PR:
#13138
For the time being (until this is debugged and fixed), this change is
reverted and the Nuxt module will still be built with the
nuxt-module-builder.

The changed build-setup led to an error in `nuxt dev` and the navigation
in the E2E test apps did not work. The error message:
```
ERROR  [worker reload] [worker init] Package import specifier "#internal/nitro/virtual/app-config" is not defined in package /Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/nitropack/package.json imported from /Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/nitropack/dist/runtime/config.mjs
```

Similar errors were reported here:

- nuxt/content#2736
- nuxt/icon#204
- nuxt/nuxt#13801
@Loosie94
Copy link

I also had this when switching from Yarn to PNPM. Removing the node_modules folder and run pnpm i did the trick for me.

@manchenkoff
Copy link
Author

Interesting 🤔 for me it didn't work, the project created with pnpm and reinstalled node_modules still triggers the same error 😕

@manchenkoff
Copy link
Author

I've tried to create a new project after the Nuxt release, but the issue persists

  • nuxt/content: 2.13.2
  • nuxt: 3.13.0

Is there any workaround by any chance? @farnabaz @atinux @benjamincanac
Thanks

@mp-mello
Copy link

In case you're still looking for a workaround adding overrides to your package.json worked for me as mentioned here: nuxt/icon#204 (comment)

  "overrides": {
    "nitropack": "2.9.5"
  }

Only version 2.9.5 worked for me.

@rogrile
Copy link

rogrile commented Sep 17, 2024

I tried the above (overriding the nitropack) but it still persists.
I am using nuxt 3.13.2 and Nuxt Content doesn't work..

@kogratte
Copy link

Same observation here.

From other similar issues, it seems to be related to imports, which are currently done on "nitropack/**".

They should instead be done using "#imports", or at least, this his how it has been solved elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants