Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node 0.12.x const in strict mode issue

I'm running node v0.12.7, and installed protractor through 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:

[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).

Using --harmony flag on protractor doesn't work. Do I need to install a specific version of protractor to be compatible with node 0.12.7? Or should I use babeljs to compile ES6 to ES5?

If babeljs is the answer, how would I use it for protractor?

like image 484
Ramtin Soltani Avatar asked Mar 22 '16 05:03

Ramtin Soltani


1 Answers

Do I need to install a specific version of protractor to be compatible with node 0.12.7

You need protractor version 2.

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

enter image description here

like image 146
basarat Avatar answered Nov 17 '22 09:11

basarat