I recently started working with Vue and have encountered a simple component issue. Sometimes, when I run npm run serve
or save a file that is already being served, I receive the following error message:
E:\Development\website\app>npm run serve
> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d1a080f1e0419082d5d435d435c">[email protected]</a> serve E:\Development\website\app
> vue-cli-service serve
INFO Starting development server...
98% after emitting CopyPlugin
ERROR Failed to compile with 1 errors 17:08:52
error in ./src/components/LoginModal.vue
Module Error (from ./node_modules/eslint-loader/index.js):
E:\Development\website\app\src\components\LoginModal.vue
3:13 error Parsing error: Unexpected token, expected "}"
1 | <script>
2 | export default {
> 3 | name: 'LoginModal',
| ^
4 | props: {},
5 | data: () => {
6 | return {
✖ 1 problem (1 error, 0 warnings)
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js& 2:0-49 7:16-26
@ ./src/App.vue?vue&type=script&lang=js&
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.45.105:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
Contrary to the error message, there isn't an unexpected "}". The actual error sometimes reads as follows:
1:1 error Parsing error: Unexpected token, expected "<"
This issue is frustrating me. Any suggestions on how to resolve this?