pnpm build - Error
Hey guys,
Im facing a weird error and i dont get far.
When i want to use
pnpm build it loads like 20 years and it gives me a weird error.
I appreciate the help7 Replies
Hi @cRiZZly. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry you're experiencing issues with
pnpm build in your Nuxt project. Based on the knowledge sources provided, there are a few common causes for build errors with Nuxt and pnpm:
1. Missing or Incorrect Files in Docker/CI: If you're using Docker, make sure you have a proper .dockerignore file. If node_modules is copied into the container, it can cause module resolution issues, leading to errors like "Cannot find module" during build. The solution is to ensure .dockerignore excludes node_modules so dependencies are installed fresh inside the container, not copied from your host machine Docker Build Problem "Error: Cannot find module".
2. Vite/Stencil Integration Issues: If you are using Stencil web components, there are known issues with Vite (the default builder for Nuxt 3+) not loading Stencil components correctly in build mode, even if they work in dev mode. This can result in errors about missing entry files. The workaround may involve adjusting Stencil's enableImportInjection or waiting for Vite improvements Nuxt build - fail to add web component dependency.
3. Build Tooling Bugs: There are reports of build errors in certain Nuxt versions, especially with tree-shaking and composables, such as "Cannot split a chunk that has already been edited." In some cases, downgrading Nuxt (e.g., from 4.1.1 to 4.1.0) resolved the issue temporarily until a fix was released Nuxt 4.1.1: Nuxt Build Error: [nuxt:tree-shake-composables:transform] Cannot split a chunk that has already been edited.
4. Long Build Times and HMR Issues: If your build is taking a very long time and then fails, it could be related to hot module replacement (HMR) or server connection issues, especially during development. Restarting the dev server or your machine sometimes helps, but persistent issues may require checking your network setup or updating dependencies ERROR [unhandledRejection] connect ECONNREFUSED 127.0.0.1:41119.
What you can try:
- Ensure your .dockerignore is set up if using Docker.
- Try deleting node_modules and pnpm-lock.yaml, then run pnpm install again.
- If you recently upgraded Nuxt, try downgrading to a previous version that worked for you.
- Check for any custom Vite or Stencil configuration if you use those tools.
- Make sure all dependencies are compatible with your Node.js and Nuxt versions.
If you can provide the specific error message you see after the long build, I can help you further pinpoint the issue. The knowledge sources do not contain a universal fix for "weird errors" after a long build, but the above are the most common causes and solutions reported.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@280061117626318848> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Error 1:
- [22:44:56] ERROR Invalid module ".prisma" is not a valid package name imported from C:\Users\david\Desktop\Dashboard\node_modules.pnpm@prisma+client@6.17.1_prism_aa86bf8868181e9b395ea4b96edde3fd\node_modules@prisma\client\default.js
Error 2:
- [nitro 23:07:20] ERROR TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ".prisma" is not a valid package name imported from C:\Users\david\Desktop\Dashboard\node_modules.pnpm@prisma+client@6.16.2_prism_a1e4ef4512c567b6d1761f11f6347f6b\node_modules@prisma\client\default.js
undefined
This is what i get.
@kapa.ai
Let me check the knowledge base for you again. One moment! :books:
Sorry @cRiZZly, 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?
bump
Where you able to fix it? I have the exact same issue.
Nop. I switched to postgres/drizzle
Cuz no one replyed