Error after updating packages
Attaching to flavibot-web-1 flavibot-web-1 | flavibot-web-1 | > web@1.1.128 start /app/apps/web flavibot-web-1 | > node .output/server/index.mjs flavibot-web-1 | flavibot-web-1 | Listening on http://0.0.0.0:15174 flavibot-web-1 | [request error] [unhandled] [GET] http://127.0.0.1:15174/ flavibot-web-1 | Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/apps/web/.output/server/node_modules/unhead/dist/server.mjs' imported from /app/apps/web/.output/server/chunks/routes/renderer.mjs flavibot-web-1 | at finalizeResolution (node:internal/modules/esm/resolve:274:11) flavibot-web-1 | ... 6 lines matching cause stack trace ... flavibot-web-1 | at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { flavibot-web-1 | cause: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/apps/web/.output/server/node_modules/unhead/dist/server.mjs' imported from /app/apps/web/.output/server/chunks/routes/renderer.mjs flavibot-web-1 | at finalizeResolution (node:internal/modules/esm/resolve:274:11) flavibot-web-1 | at moduleResolve (node:internal/modules/esm/resolve:864:10) flavibot-web-1 | at defaultResolve (node:internal/modules/esm/resolve:990:11) flavibot-web-1 | at #cachedDefaultResolve (node:internal/modules/esm/loader:757:20) flavibot-web-1 | at ModuleLoader.resolve (node:internal/modules/esm/loader:734:38) flavibot-web-1 | at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:317:38) flavibot-web-1 | at #link (node:internal/modules/esm/module_job:208:49) flavibot-web-1 | at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { flavibot-web-1 | code: 'ERR_MODULE_NOT_FOUND', flavibot-web-1 | url: 'file:///app/apps/web/.output/server/node_modules/unhead/dist/server.mjs' flavibot-web-1 | }, flavibot-web-1 | statusCode: 500, flavibot-web-1 | fatal: false, flavibot-web-1 | unhandled: true, flavibot-web-1 | statusMessage: undefined, flavibot-web-1 | data: undefined flavibot-web-1 | } flavibot-web-1 | [request error] [unhandled] [GET] http://127.0.0.1:15174/__nuxt_error?error=true&url=%2F&statusCode=500&statusMessage=Server+Error&message=Server+Error flavibot-web-1 | Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/apps/web/.output/server/node_modules/unhead/dist/server.mjs' imported from /app/apps/web/.output/server/chunks/routes/renderer.mjs flavibot-web-1 | at finalizeResolution (node:internal/modules/esm/resolve:274:11) flavibot-web-1 | ... 6 lines matching cause stack trace ... flavibot-web-1 | at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { flavibot-web-1 | cause: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/apps/web/.output/server/node_modules/unhead/dist/server.mjs' imported from /app/apps/web/.output/server/chunks/routes/renderer.mjs flavibot-web-1 | at finalizeResolution (node:internal/modules/esm/resolve:274:11) flavibot-web-1 | at moduleResolve (node:internal/modules/esm/resolve:864:10) flavibot-web-1 | at defaultResolve (node:internal/modules/esm/resolve:990:11) flavibot-web-1 | at #cachedDefaultResolve (node:internal/modules/esm/loader:757:20) flavibot-web-1 | at ModuleLoader.resolve (node:internal/modules/esm/loader:734:38) flavibot-web-1 | at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:317:38) flavibot-web-1 | at #link (node:internal/modules/esm/module_job:208:49) flavibot-web-1 | at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { flavibot-web-1 | code: 'ERR_MODULE_NOT_FOUND', flavibot-web-1 | url: 'file:///app/apps/web/.output/server/node_modules/unhead/dist/server.mjs'
13 Replies
Hi @flav. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error message you are seeing:
indicates that the server build is trying to import a file from the
If a dependency like
See example and advice here. 2. Clean Install Before Build
Sometimes, stale or incorrect
This approach is also mentioned here. 3. .dockerignore or Build Artifacts
If you are using Docker, ensure that your
See this Docker-related issue. 4. Nuxt Output Not Being Generated Properly
If your
See this related experience. 5. Recent Updates to @unhead/vue
There have been recent updates and bug fixes to
See changelogs and PRs for recent fixes. What you should do: - Move all runtime dependencies (including
unhead package, but it cannot find it in the expected location inside .output/server/node_modules/.
Based on the knowledge sources, here are some likely causes and solutions:
1. Missing or Incorrect Dependencies in Production BuildIf a dependency like
unhead (or its related packages, such as @unhead/vue) is only listed in devDependencies, it may not be installed in production environments, leading to missing modules at runtime. Several sources recommend moving all dependencies required at runtime (including those used by Nuxt or its modules) from devDependencies to dependencies in your package.json before building and deploying. This ensures they are available in the production build output, especially in environments like Docker or cloud platforms where only dependencies are installed by default.See example and advice here. 2. Clean Install Before Build
Sometimes, stale or incorrect
node_modules or lock files can cause missing files in the build output. It's recommended to:
- Delete node_modules and your lock file (package-lock.json or pnpm-lock.yaml).
- Run a fresh install (npm install or pnpm install).
- Then run your build command again.This approach is also mentioned here. 3. .dockerignore or Build Artifacts
If you are using Docker, ensure that your
.dockerignore file is not causing issues by copying over a local node_modules folder, which can interfere with the build process and result in missing modules in the final image.See this Docker-related issue. 4. Nuxt Output Not Being Generated Properly
If your
.output folder is empty or missing files, it could be due to a misconfiguration or a corrupted project state. In some cases, starting a new Nuxt project and carefully copying your files over can resolve mysterious build issues.See this related experience. 5. Recent Updates to @unhead/vue
There have been recent updates and bug fixes to
@unhead/vue (which is related to unhead), including fixes for SSR and module hoisting issues. If you recently updated packages, ensure you are using a compatible and up-to-date version of @unhead/vue and related dependencies.See changelogs and PRs for recent fixes. What you should do: - Move all runtime dependencies (including
@unhead/vue and unhead) to dependencies in your package.json.
- Delete node_modules and your lock file, then reinstall and rebuild.
- If using Docker, ensure your .dockerignore is set up correctly and you are not copying local node_modules into the image.
- Double-check that your .output directory is being populated after build.
- Make sure you are using compatible versions of Nuxt and its dependencies, especially after updates.
If after these steps the issue persists, please provide your package.json and build logs for further troubleshooting.
---
If you need more specific guidance, please share your package.json and the exact steps you use to build and run your app.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@360783331962650624> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai
Let me check the knowledge base for you again. One moment! :books:
Sorry @flav, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
Let me check the knowledge base for you again. One moment! :books:
flav has been warned
Reason: Mass mention
----------------------
Based on your
Your error is caused by missing runtime dependencies (
package.json and the error you posted, the root cause is that the Nuxt server output is trying to import unhead/dist/server.mjs, but this package is not present in your .output/server/node_modules/ directory at runtime.
Key points from your package.json:
- Neither unhead nor @unhead/vue are listed in your dependencies or devDependencies.
What the knowledge sources say:
- Nuxt (especially v3 and v4) relies on @unhead/vue (and sometimes unhead) for head management. If these are missing from your dependencies, the build output may reference files that do not exist, resulting in the ERR_MODULE_NOT_FOUND error you are seeing.
- After updating packages, it is crucial that all runtime dependencies are present in your dependencies (not just devDependencies), especially for server builds and deployment environments. This is a common cause of missing module errors in production, as only dependencies are installed in most production setups see this advice.
- There have been recent updates and bug fixes to @unhead/vue and related packages, so you should use a compatible and up-to-date version see changelogs and PRs for recent fixes.
What you should do:
1. Add @unhead/vue to your dependencies:
(You may also need to add unhead if your build references it directly.)
2. Clean and reinstall:
- Delete node_modules and your lock file (package-lock.json or pnpm-lock.yaml).
- Run a fresh install: npm install or pnpm install.
3. Rebuild your Nuxt app:
- Run your build command again (nuxi build or nuxt build).
This should ensure that the required files are present in your build output and resolve the ERR_MODULE_NOT_FOUND error.
If you continue to have issues, double-check that your .output/server/node_modules/ directory contains the unhead and @unhead/vue packages after build.
---
Summary:Your error is caused by missing runtime dependencies (
unhead/@unhead/vue). Add them to your dependencies, clean, reinstall, and rebuild. This is a common issue after package updates if dependencies are not properly declared for production builds see this advice.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@360783331962650624> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai navigating to the page works fine but refreshing the page give The requested module '@vueuse/core' does not provide an export named 'toValue'
Let me check the knowledge base for you again. One moment! :books:
----------------------
The error message:
typically indicates a version mismatch between your code (or a dependency) and the installed version of
This error is caused by a version mismatch or build incompatibility with
@vueuse/core. The toValue export was introduced in later versions of @vueuse/core, so if your code or a library expects it but your installed version does not provide it, you will see this error.
Relevant findings from the knowledge sources:
- There are known issues with recent versions of @vueuse/core (v14+) and Nuxt, especially after the @vueuse packages switched to a new build system (tsdown). This has caused compatibility problems, particularly with SSR and module resolution, leading to errors like missing exports or build failures on certain platforms see here.
- One user specifically resolved similar issues by downgrading @vueuse/core from 14.0.0 to 13.9.0, as the newer version caused problems with Nuxt's build system and module resolution see here.
What you should do:
- Try downgrading @vueuse/core (and any related @vueuse packages) to version 13.9.0 in your package.json:
- Delete your node_modules and lock file, then reinstall and rebuild your project.
This should resolve the "does not provide an export named 'toValue'" error when refreshing the page.
If you are using any other libraries that depend on @vueuse/core, ensure they are compatible with the version you install.
---
Summary:This error is caused by a version mismatch or build incompatibility with
@vueuse/core. Downgrading to 13.9.0 has resolved this for other Nuxt users see here.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@360783331962650624> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai STILL THE SAME ISSUE
Let me check the knowledge base for you again. One moment! :books:
----------------------
I'm sorry to hear you're still experiencing the same issue:
The requested module '@vueuse/core' does not provide an export named 'toValue'Based on the knowledge sources, this error is associated with recent changes in the
@vueuse/core package, particularly after version 14.0.0, which introduced compatibility issues with Nuxt's build system. Multiple users have reported that downgrading @vueuse/core to version 13.9.0 resolved similar issues, especially on Windows and with SSR or Vite builds. However, if you have already tried this downgrade and the problem persists, the knowledge sources do not provide a definitive solution beyond this workaround.
Additionally, some users noted that the issue may be related to how dependencies are installed or deduped, and that clearing node_modules and lock files, then reinstalling, sometimes helps. But again, if you have already done this, the sources do not offer further concrete steps.
If the downgrade and clean install do not resolve the issue, the knowledge sources do not contain enough information to provide a confident answer or alternative solution for your specific scenario. You may need to monitor the related issues for updates or seek further help from the Nuxt or VueUse communities, as this appears to be an ongoing compatibility problem see discussion and confirmations here.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@360783331962650624> Kapa.ai is still learning and improving, please let me know how I did by reacting below.