英文:
Nuxt 3 + Vite: Rollup failed to resolve import "vue-router"
问题
在我的 Nuxt 3 应用程序构建过程中,出现了以下错误消息:
[vite]: Rollup failed to resolve import "vue-router" from "[...]/node_modules/nuxt/dist/app/components/test-component-wrapper.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
该应用程序在本地稳定运行。
这个错误是什么意思,我该如何修复它?
期待反馈!
最好的问候,
Tobi
设置:
- nuxt 3.5.2
- vite/4.3.1
- linux-x64 node-v18.14.2
英文:
During the build process of my Nuxt 3 application, the following error message appears:
[vite]: Rollup failed to resolve import "vue-router" from "[...]/node_modules/nuxt/dist/app/components/test-component-wrapper.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
The application runs stably locally.
What does this error mean and how can I fix it?
I look forward to feedback!
Best regards,
Tobi
Setup:
- nuxt 3.5.2
- vite/4.3.1
- linux-x64 node-v18.14.2
答案1
得分: 3
我通过简单删除node_modules
和package-lock.json
来解决了这个问题。
然后npm run build
顺利运行了。
显然有些东西被"连线"错了。
最好的祝愿,Tobi
英文:
I solved this by simply deleting node_modules
+ package-lock.json
.
npm run build
then ran smoothly.
Apparently something was "wired" wrong.
Best regards, Tobi
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论