nickywan123
4 months ago
420
2
Vue

[Vue warn]: Cannot find element: vue-app

Posted 4 months ago by nickywan123

I wanted to create a new instance of vue and followed the documentation.

So here is my index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>VueJs Tutorial</title>
    <link rel="stylesheet" href="styles.css">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="vue-app">
        <h2>{{name}}</h2>
    </div>
    <script src="app.js"></script>
</body>
</html>

app.js:


new Vue({
    el:'#vue-app',
    data:{
        name:'Lord Jesus'
    }
});

Trying to output the name on my browser but it couldn't find vue-app and says

[Vue warn]: Cannot find element: vue-app

I followed the tutorial course and the author wrote the exact same way but it works fine for him. Is there anything wrong with my code?

Please sign in or create an account to participate in this conversation.