我的nuxt应用正在本地运行,没有问题,但是当我尝试将站点部署到Netlify时,出现了如下错误:
“未找到模块:错误:无法解析'〜/ components / Navbar.vue' '/ opt / build / repo / layouts'“
我遇到以下错误:
ERROR in ./layouts/default.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./layouts/default.vue?vue&type=script&lang=js&)
6:49:50 PM: Module not found: Error: Can't resolve '~/components/Navbar.vue' in '/opt/build/repo/layouts'
6:49:50 PM: @ ./layouts/default.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./layouts/default.vue?vue&type=script&lang=js&) 8:0-45 11:12-18
6:49:50 PM: @ ./layouts/default.vue?vue&type=script&lang=js&
6:49:50 PM: @ ./layouts/default.vue
6:49:50 PM: @ ./.nuxt/App.js
6:49:50 PM: @ ./.nuxt/index.js
6:49:50 PM: @ ./.nuxt/client.js
6:49:50 PM: @ multi ./.nuxt/client.js
请帮助, 预先感谢。
答案 0 :(得分:1)
确保文件的大小写正确。
<script>
import Navbar from '~/components/Navbar.vue'
export default {
components: {
Navbar
}
}
</script>
失败:components/NavBar.vue
失败:components/Navbar.Vue
正确:components/Navbar.vue