"Module not found" 将Nuxtjs应用程序部署到Netlify时出错



我的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

请帮忙,提前谢谢。

确保您的文件具有正确的导入大小写。

<script>
  import Navbar from '~/components/Navbar.vue'
  export default {
    components: {
      Navbar
    }
  }
</script>

失败:components/NavBar.vue
失败:components/Navbar.Vue

正确:components/Navbar.vue

相关内容

  • 没有找到相关文章

最新更新