Protractor SyntaxError:意外的令牌

时间:2017-02-08 21:00:38

标签: protractor

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

配置文件:

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)

2 个答案:

答案 0 :(得分:1)

您是否拥有最新版本的NodeJS?

我遇到了一个类似的问题,它是通过更新节点

修复的

答案 1 :(得分:0)

这是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"