nuxt.js通过vue-cli构建并完成安装依赖,运行npm run dev 报错。

D:\code\nuxtjsdemo\node_modules\nuxt\lib\core\middleware\nuxt.js:72
      const policies = this.options.render.csp.policies ? {...this.options.rende
r.csp.policies} : null

SyntaxError: Unexpected token ...

平台环境
nodejs 8.2.0
vue-cli 2.9.3

阅读 3.4k
1 个回答

写得很明确了

SyntaxError: Unexpected token ...

对象解构赋值语法报错

解决方案:

  1. 查一下 node 9.x 已经支持 对象解构赋值了没有,换更新的nodejs
  2. 如果还未支持,使用babel + babel 插件babel-plugin-transform-object-rest-spread
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进