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 start application, Nuxt loading node modules from incorrect directory

See original GitHub issue

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

Screen Shot 2022-09-15 at 2 03 51 PM

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:28 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
pi0commented, Sep 16, 2022

As an update, we had a quick call with @marcodarko. Removing or renaming stale node_modules from 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.

2reactions
pi0commented, Sep 16, 2022

Thanks once again @marcodarko for reproduction. Moving this issue to https://github.com/nuxt/framework/issues/7609. It is related to the vite-node package that is enabled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nuxt start requires node_modules to be present in order to run
I found Nuxt build will not bundle files in node_modules, so if you want to bundle all dependencies into .nuxt , you should...
Read more >
Modules directory - Nuxt
Write your own Module. Modules are functions. They can be packaged as npm modules or directly included in your project source code. nuxt.config.js...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
Read more >
Cannot find module 'X' error in Node.js | bobbyhadz
If the error is not resolved, try to delete your node_modules and package-lock.json (not package.json ) files, re-run npm install and restart your...
Read more >
Creating Server-side Rendered Vue.js Apps Using Nuxt.js
When initially loading your website, your browser doesn't receive a complete page to display. ... cd my-nuxt-project npm install # Or yarn npm...
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