Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Module not found" Error when deploying Nuxtjs app to Netlify

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.

like image 442
hiraz Avatar asked Feb 02 '19 13:02

hiraz


1 Answers

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

like image 88
talves Avatar answered Sep 28 '22 09:09

talves