简体   繁体   English

严格模式问题中的节点0.12.x const

[英]node 0.12.x const in strict mode issue

I'm running node v0.12.7, and installed protractor through npm. 我正在运行节点v0.12.7,并通过npm安装了量角器。 Now I'm trying to run the conf.js using this simple tutorial , and I get the following error when executing the command protractor conf.js : 现在,我正在尝试使用此简单教程来运行conf.js,并且在执行命令protractor conf.js时遇到以下错误:

[launcher] Process exited with error code 1
C:\Users\ramtin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:25
const builder = require('./builder');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478: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> (C:\Users\ramtin\AppData\Roaming\npm\node_modules\protractor\built\protractor.js:3:17)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Can't update node due to dependency issues it will produce (I'm working on an already-built project which used node 0.12.17). 由于会产生依赖关系问题,因此无法更新节点(我正在研究一个使用节点0.12.17的已构建项目)。

Using --harmony flag on protractor doesn't work. 在量角器上使用--harmony标志无效。 Do I need to install a specific version of protractor to be compatible with node 0.12.7? 是否需要安装特定版本的量角器才能与节点0.12.7兼容? Or should I use babeljs to compile ES6 to ES5 ? 还是应该使用babeljsES6编译为ES5

If babeljs is the answer, how would I use it for protractor? 如果babeljs是答案,我如何将其用于量角器?

Do I need to install a specific version of protractor to be compatible with node 0.12.7 我是否需要安装特定版本的量角器以与节点0.12.7兼容

You need protractor version 2. 您需要量角器版本2。

From https://github.com/angular/protractor#compatibility 来自https://github.com/angular/protractor#compatibility

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM