我使用推荐的语法安装了聚合物: npm install -g polymer-cli@next
我使用 polymer init
接口创建了一个聚合物 2 元素。
我遇到的问题是当我运行polymer serve
时,出现以下错误:
error: cli runtime exception: SyntaxError: Unexpected token [
error: SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/local/lib/node_modules/polymercli/node_modules/polyserve/lib/start_server.js:33:30)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)`
我尝试卸载并重新安装聚合物,但遇到了同样的问题。任何想法??
修复了我的聚合物客户端错误。
事实证明,新版本的聚合物需要节点v6或更高版本......当我安装时几乎没有注意到该通知消息。