nuxt: [RC.5] Rollup error: Could not load `.nuxt/dist/server/server.mjs`
Environment
Nuxt CLI v3.0.0-rc.5 RootDir: /home/max/Projects/<hidden_name_of_project> Nuxt project info:
- Operating System:
Linux - Node Version:
v18.4.0 - Nuxt Version:
3.0.0-rc.5 - Package Manager:
yarn@3.2.0 - Builder:
vite - User Config:
css,modules,typescript,buildModules,plugins,vite,runtimeConfig - Runtime Modules:
(),() - Build Modules:
@pinia/nuxt@0.1.9
Reproduction
Unfortunately I cannot reproduce this with clear project (and cannot full project code as it’s not open source), however project was buildable with 3.0.0-rc.4 version, so I believe it’s not problem with project’s codebase.
Describe the bug
Nuxt CLI v3.0.0-rc.5 is not able to clear build project at the first time (no node_modules, .nuxt, .output directories in project dir). Running yarn build (after yarn install ofc) cause following error:
Nuxt CLI v3.0.0-rc.5
ℹ Vite client warmed up in 4351ms
ℹ Client built in 16800ms
ℹ Building server...
✔ Server built in 90ms
✔ Generated public .output/public
start Building server...
ERROR Rollup error: Could not load /home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs'
ERROR Could not load /home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs'
If I run yarn build command again after this error it will succeed. Most interesting thing is: If I delete .nuxt and .output directories after successful build and run yarn build again - build will succeed at first try. However, problem will appear again after deleting node_modules, .nuxt, .output and running yarn install and yarn build again.
Also, removing node_modules and not removing .nuxt and .output will not cause the issue.
Additional context
Why is it important?
It breaks build pipelines and force developers to build project twice inside Docker container.
Logs
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 21 (6 by maintainers)
Getting those error messages after using
yarn buildas well.I am using PhosphorIcons which works fine in other projects.
But with it, I could reproduce my error messages. Maybe it is helpful to solve this issue.
See https://github.com/geyermichael/nuxt-build-test
PS: First time helping on a github issue. If I missed any further necessary information please let me know. 😃
I’m also experiencing this. Rolling back to nuxt v3.0.0-rc.4 also doesn’t work easily as it seems that many of the nuxt-related dependencies aren’t pinned and so things like nuxi, @nuxt/kit, @nuxt/schema etc are installing v3.0.0-rc.5
更新一下依赖 “@pinia/nuxt”: "^0.3.0"和 “nuxt”: “3.0.0-rc.5”,然后删除.nuxt文件夹和node_modules文件夹和pnpm-lock.yaml文件,可以解决问题哈