7

My nuxt app is runing locallly without problems but when im trying to deploy the site to Netlify I got error like:

"Module not found: Error: Can't resolve '~/components/Navbar.vue' in '/opt/build/repo/layouts'"

I'm getting the following error:

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

Please help, thanks in advance.

Hasan
  • 1,243
  • 12
  • 27
hiraz
  • 77
  • 1
  • 6

1 Answers1

11

Make sure your file has the correct case for your import.

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

    components: {
      Navbar
    }
  }
</script>

Fails: components/NavBar.vue
Fails: components/Navbar.Vue

Correct: components/Navbar.vue

talves
  • 13,993
  • 5
  • 40
  • 63
  • 1
    Netlify support agrees: this is almost certainly the problem. It can be pretty hard to change case in git if you have a non-case-sensitive filesystem like OSX and Windows do, this might help you: https://stackoverflow.com/questions/17683458/how-do-i-commit-case-sensitive-only-filename-changes-in-git – fool Feb 02 '19 at 17:52