Search code examples
node.jsnpmwebpackvue.jsvue-loader

Vue-Router error: "Module build failed: SyntaxError: Unexpected token"


I'm getting the error below by trying to compile this VueJS demo project. I update NPM to the latest stable version and all of the apps dependencies but the error remains.

As soon as I remove vue-router from index.js and main.js the error is gone. This is the error message:

> ERROR in ./~/vue-loader/lib/template-compiler?{"id":"data-v-0a5cdd23"}!./~/vue-loader/lib/selector.js?type=template&index=0!./src/components/Meetup/Meetups.vue Module build failed: SyntaxError: Unexpected token (122:82)
> 
> 
> at Parser.pp$4.raise
> (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:2610:13)
>     at Parser.pp.unexpected (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:637:8)
>     at Parser.pp$3.parseExprAtom (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:2094:10)
>     at Parser.parseExprAtom (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:4372:24)
>     at Parser.pp$3.parseExprSubscripts (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1955:19)
>     at Parser.pp$3.parseMaybeUnary (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1932:17)
>     at Parser.pp$3.parseExprOp (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1893:41)
>     at Parser.pp$3.parseExprOp (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1893:24)
>     at Parser.pp$3.parseExprOps (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1876:90)
>     at Parser.pp$3.parseMaybeConditional (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1857:19)
>     at Parser.pp$3.parseMaybeAssign (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1832:19)
>     at Parser.pp$3.parseParenAndDistinguishExpression (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:2139:30)
>     at Parser.pp$3.parseExprAtom (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:2061:41)
>     at Parser.parseExprAtom (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:4372:24)
>     at Parser.pp$3.parseExprSubscripts (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1955:19)
>     at Parser.pp$3.parseMaybeUnary (/home/tom/Desktop/DevMeetup/node_modules/vue-template-es2015-compiler/buble.js:1932:17)
> @ ./src/components/Meetup/Meetups.vue 5:2-186  @ ./src/router/index.js
> @ ./src/main.js  @ multi ./build/dev-client ./src/main.js

How to fix it? Any ideas are appreciated. Edit: I tried npm install again and got a message about url-loader being vulnerable. I got suggested to run npm install --save-dev [email protected] to fix it. The error remains but could this the root of the cause?


Solution

  • I can't see the error, compile finish successfully. Do you tried to clone again your repo? I use npm: 6.0.1 node: v8.11.1

    enter image description here