nuxt: Cannot start application, Nuxt loading node modules from incorrect directory
Environment
- Operating System:
Darwin - Node Version:
v17.9.0 - Nuxt Version:
3.0.0-rc.10 - Nitro Version:
0.5.3 - Package Manager:
npm@8.5.5 - Builder:
vite - User Config:
- - Runtime Modules:
- - Build Modules:
-
Reproduction
npx nuxi init nuxt-app npm i npm run dev
Describe the bug
Immediately hit with “Cannot find package ‘@vue/server-renderer’ imported from /Users/marco/node_modules/vue/server-renderer/index.mjs”
I’ve tried installing multiple times but no luck so far.
Additional context
Logs
✔ Nitro built in 481 ms
ℹ Vite client warmed up in 1322ms
[nuxt] [request error] [unhandled] [500] Cannot find package '@vue/server-renderer' imported from /Users/marco/node_modules/vue/server-renderer/index.mjs
at new NodeError (node:internal/errors:372:5)
at packageResolve (node:internal/modules/esm/resolve:908:9)
at moduleResolve (node:internal/modules/esm/resolve:957:20)
at defaultResolve (node:internal/modules/esm/resolve:1173:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:604:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36)
^C
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 28 (15 by maintainers)
As an update, we had a quick call with @marcodarko. Removing or renaming stale
node_modulesfrom home directory solves the issue. It is an environment-specific issue. Trying to find a solution for it but as quick workaround, simply remove the directory.Thanks once again @marcodarko for reproduction. Moving this issue to https://github.com/nuxt/nuxt.js/issues/14952. It is related to the vite-node package that is enabled.
Could that issue be related to https://github.com/nuxt/nuxt.js/issues/14802 too?
Happy to meet anytime
@marcodarko @angelhdzmultimedia Any hope we can set a session so you can share your desktop? (Still trying to reproduce locally but might help to speed up)
“It works on my machine”
I do but I have tried creating a new project in multiple locations and all the same result. I’ve tried deleting them and reinstalling but same thing happens. These are the logs: https://github.com/nuxt/nuxt.js/issues/14928
Tried to uninstall my global vue module and rerun to see if it was interfering but no luck so then I re-installed it and now get a new error (probably because it loaded the wrong version of vue from /User/marco not the project dir):