nuxt: Cannot find package @unhead/shared

Environment

CentOS 7 nodejs-16.20.2 nuxi@3.6.5

Reproduction

Unable to reproduce

Describe the bug

My project has been upgraded from nuxt3.3 to 3.65. I have no problem debugging and starting index.mjs in windows, but the following exception will be thrown whenever I visit the home page on the Linux server

[nuxt] [request error] [unhandled] [500] Cannot find package '@unhead/shared' imported from /root/mqingmo/.output/server/node_modules/@unhead/ssr/dist/index.mjs
  at new NodeError (node:internal/errors:387:5)
  at packageResolve (node:internal/modules/esm/resolve:852:9)
  at moduleResolve (node:internal/modules/esm/resolve:901:20)
  at defaultResolve (node:internal/modules/esm/resolve:1115:11)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
  at link (node:internal/modules/esm/module_job:75:36)

Additional context

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

For those using nvm, make sure you have the latest version.

I experienced a similar issue after a commit from a colleague, and I found out he had the latest nvm version, 0.39.5, while mine was 0.35.x. After upgrading, removal of node_modules and package-lock.json and npm install, the issue vanished. Issue was valid on both windows and ubuntu (via wsl2).

Have you tried using the upgrade tool?

npx nuxi upgrade --force will clear your lockfile and node_modules to upgrade all your dependencies.