Nuxt.js builds and installs the dependencies through vue-cli, and runs npm run dev to report an error.

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 ...

platform environment
nodejs 8.2.0
vue-cli 2.9.3

Mar.01,2021

is very clear

SyntaxError: Unexpected token.

object deconstruction assignment syntax error

solution:

  1. check whether node 9.x supports object deconstruction assignment, and replace it with the updated nodejs .
  2. if it is not already supported, use babel + babel plug-in babel-plugin-transform-object-rest-spread
Menu