Vue路由器错误:“模块构建失败:SyntaxError:意外令牌”

时间:2018-07-31 22:15:19

标签: node.js npm webpack vue.js vue-loader

通过尝试编译此BS-collapse-toggle,我收到以下错误。 我将NPM更新为最新的稳定版本和所有应用程序依赖项,但错误仍然存​​在。

我从vue-routerindex.js中删除了main.js之后,错误就消失了。 这是错误消息:

> 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

如何解决?任何想法表示赞赏。 编辑:我再次尝试npm install,并收到有关 url-loader 容易受到攻击的消息。我建议run npm install --save-dev url-loader@1.0.1进行修复。错误仍然存​​在,但这可能是原因所在吗?

1 个答案:

答案 0 :(得分:1)

我看不到错误,编译成功。您是否尝试过再次克隆您的仓库?  我用 npm:6.0.1 节点:v8.11.1

enter image description here