pm2部署Unexpected token ...报错

pm2部署时报错,已经引用了babel插件,但还是报es6的错误,求大神指教,万分感谢!!

   const policies = this.options.render.csp.policies ? {...this.options.render.csp.policies} : null
                                                           ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/www/baotuan/nuxt/source/node_modules/nuxt/lib/core/renderer.js:19:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt@1.1.0 build: `nuxt build && backpack build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nuxt@1.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-06-23T09_16_41_689Z-debug.log

  post-deploy hook failed


Deploy failed

node -v 9.6.1
npm -v 5.6.0
阅读 8.4k
2 个回答

报错是 {...this.options.render.csp.policies}不支持,也就是不支持object spread语法,可能你的node版本过低?

我这边升级node到12.x版本,这个问题就解决了。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题