简体   繁体   中英

Vue.js app throws error “Cannot find element: #app”

I am currently using Webpack as a build system and have set up everything properly so that it was working well.

All of the sudden, it started giving me an error stating:

[Vue warn]: Cannot find element: #app

I tried running the beforeCreated() hook on the root instance itself, where if the element does not exist I manually create it. But to no avail.

I have uploaded my code to Gitub, with a package.json file. It would be really amazing if someone can take a look and provide a solution.

I went spend hours going trough the code and even removed all other dependencies, but the most basic configurations, changed the import order and it still doesn't work.

Here is the link to the Github repo: Github

I think you are missing a #app element in the index.html to mount the app:

<body>
    <div id="app"></div>
    <script src="/dist/build.js"></script>
</body>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM