vue-loader: Template syntax error Component template should only contain exactly one root element
Using:
Node v6.6.0.
vue-loader v9.5.1
Vue v2.0.1
Vue-Router 2.0.0
Vuex 2.0.0
Vuex-Router-Sync 2.1.1
The error says it all:
I fixed it by enclosing everything inside Page1.vue by a <div> without class and id attributes. This enclosing <div> or root element wasn’t required in Vue@1.x. Does it really have to be required? Can it be optional like before? Thanks.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (2 by maintainers)
Yes, this is required in 2.0.
@yyx990803 could you explain the reasons why this is required on 2.0? I just want to learn about the core.
Me too! Your vue-loader version problem! try npm install --save-dev vue-loader@8.3.0
Perfect solution