【问题标题】:Polymer CLI: SyntaxError: Unexpected strict mode reserved wordPolymer CLI: SyntaxError: Unexpected strict mode reserved word
【发布时间】:2016-09-28 18:41:59
【问题描述】:

我正在尝试从这里安装聚合物 CLI:https://www.polymer-project.org/1.0/docs/tools/polymer-cli

但是,安装后我在尝试运行 polymer help 时遇到错误:

[~/Documents/roottest]$ polymer help                                                                                                                                                                                   ruby:2.2.4

/opt/boxen/nodenv/versions/v0.10.26/lib/node_modules/polymer-cli/bin/polymer.js:19
  let lib = path ? require(path) : require('..');
  ^^^
SyntaxError: Unexpected strict mode reserved word
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
[~/Documents/roottest]$ node --version                                                                                                                                                                                 ruby:2.2.4
v0.10.26
[~/Documents/roottest]$ nodenv --version                                                                                                                                                                               ruby:2.2.4
nodenv 0.3.3

我的 node 版本是 v0.10.26,我的 nodeenv 版本是 0.3.3。我使用的是 Mac。

有人知道我将如何解决这个问题吗?

【问题讨论】:

  • 你有'use strict'吗?包含在文件开头的行? ^^^ 指向的是 ES6 语法的“let”,据我所知,旧版本的 Node.js 不支持开箱即用。
  • 在哪里?我只是想安装聚合物 cli
  • 'let' 是在 Javascript 中创建变量的另一个版本,它需要 EcmaScript 6 支持。在尝试执行文件时,您可以将一些标志传递给节点,harmony 可能是您要关注的关键字。

标签: node.js


【解决方案1】:

Polymer CLI 与 Node v0.10.26 不兼容。

setup guide 表示需要 Node 4.x 或更高版本。您实际上应该升级到latest stable version (6.2.0)。

【讨论】:

    猜你喜欢
    • 2020-12-17
    • 2023-02-25
    • 1970-01-01
    • 2020-03-29
    • 1970-01-01
    • 2018-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多