Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NUXT: Could not compile template

enter image description here

I'm getting started with nuxt. My project structure in the screenshot, I've got a vuetify carousel component that was working fine with urls as the src. Now I want to try to serve local static files. I tried:

    <template>
  <v-carousel>
    <v-carousel-item v-for="(item,i) in items" :key="i" :src="item.src"></v-carousel-item>
  </v-carousel>
</template>


    <script>

export default {
  data () {
    return {
      items: [
        {
          src: '/static/52lv.PNG'
        },
        {
          src: 'https://cdn.vuetifyjs.com/images/carousel/sky.jpg'
        },
        {
          src: 'https://cdn.vuetifyjs.com/images/carousel/bird.jpg'
        },
        {
          src: 'https://cdn.vuetifyjs.com/images/carousel/planet.jpg'
        }
      ]
    }
  }
}
</script>

but now when I run the dev server I get:

$ npm run dev

> [email protected] dev ....\js\nuxt4
> nuxt

i Preparing project for development                                                                                                                   20:23:25
i Initial build may take a while                                                                                                                      20:23:25
√ Builder initialized                                                                                                                                 20:23:25

ERROR  Could not compile template ....nuxt4\\node_modules\\@nuxt\\vue-app\\template\\App.js: Cannot resolve "~/assets/style/app.styl" from "E:\ENVS\js\nuxt4\assets\style\app.styl"

at Promise.all.templatesFiles.map (node_modules\@nuxt\builder\dist\builder.js:6009:17)

What am I doing wrong?

like image 329
user1592380 Avatar asked Dec 07 '25 03:12

user1592380


1 Answers

I had the exact issue, it turned out to be a path issue in my nuxt.config.js file under css and scripts sections. I added a assets folder with sub folders and files within them such as static > assets > etc but in my config file it was ~/assets.

I changed it to ~/static/assets/ and now it compiles correctly.

Hope this helps.

like image 148
Sebastian Avatar answered Dec 09 '25 00:12

Sebastian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!