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.

0

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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: stackoverflow.com/questions/17683458/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.