There are two problems with vue

Cannot find element:-sharpapp and Failed to mount component: template or render function not defined. Two errors

where app.vue
< template >

<div id="app">
    <router-view/>
</div>

< / template >

< script >

export default {
    name: "App"
}

< / script >

< style lang= "less" >

@import "~vux/src/styles/reset.less";

< / style >

main.js
import Vue from "vue"
import App from". / App"
import FastClick from "fastclick"

import router from". / router"
import VueCookies from "vue-cookies"
Vue.use (VueCookies);

FastClick.attach (document.body)

Vue.config.productionTip = false

/ eslint-disable no-new /
new Vue ({

el: "-sharpapp",
router,
components: { App },
template: "<App/>"

})

Why is it wrong?

Mar.21,2021

the first error points to the dom structure in index.html where id is app, and that's what el:'- sharpapp', is looking for.

the second error, render function this is the problem with your vue. Pay attention to the version of your vue-cli. The earlier version of vue-cli cannot automatically introduce the correct vue.js,. You need to manually configure the path of vue in webpack by yourself, similar to:

// entry
resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
      '@': resolve('src'),
    }
  },

try import App from'. / App' change it to import App from'. / App.vue'
if not, provide a screenshot of your directory structure

Menu