【问题标题】:Protractor SyntaxError: Unexpected tokenProtractor SyntaxError: Unexpected token
【发布时间】:2018-10-08 11:03:18
【问题描述】:

我开始使用eclipse使用量角器,配置了所有东西,nodejs,量角器,webdriver,但是在调试时或者如果我想运行测试,它总是返回这个Unexpected token

配置文件:

exports.config = {
  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'chrome'
  },

  // Spec patterns are relative to the configuration file location passed
  // to protractor (in this example conf.js).
  // They may include glob patterns.
  specs: ['example-spec.js'],

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true, // Use colors in the command line report.
  }
};

错误:

C:\Users\tgv\workspace\test7\node_modules\protractor\built\logger.js:75
    info(...msgs) {
         ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:\Users\tgv\workspace\test7\node_modules\protractor\built\configParser.js:5:18)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)

【问题讨论】:

    标签: protractor


    【解决方案1】:

    你有最新版本的 NodeJS 吗?

    我遇到了类似的问题,已通过更新节点修复

    【讨论】:

    • 这里也一样。我使用 npm install protractor 在我的 Eclipse 项目中安装了量角器。我猜它得到了最后一个版本。
    【解决方案2】:

    这是 Eclipse 中内置版本的 Node JS 的问题。它可能使用较旧的 Node 版本构建。我通过以下步骤解决了同样的问题。

    Installed this Snapshot, http://oss.opensagres.fr/angularjs-eclipse/1.3.0-SNAPSHOT/ 
    Run Configurations-> Protractor 
    Change Node JS install to be "Native NodeJS"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-17
      • 2019-02-10
      • 2019-11-10
      • 2014-07-08
      • 2013-11-15
      • 2020-09-26
      • 2011-03-09
      • 2014-01-06
      相关资源
      最近更新 更多