Installation problems with CodeceptJS on Ubuntu

I was setting up a new system to use CodeceptJS and got into a problem. I've followed these notes, but just get an error when I try to run the code. Mistake...

codeceptjs
/usr/local/lib/node_modules/codeceptjs-webdriverio/node_modules/codeceptjs/lib/mocha_factory.js:6
let mocha;
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/codeceptjs-webdriverio/node_modules/codeceptjs/lib/container.js:5:20)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

      

My node.js and npm are installed globally via the usual apt-get and npm -g

System Information ...

  • Ubuntu 17.04 x86_64
  • nodejs: 4.7.2
  • npm: 4.5.0
  • bash 4.4.5

Does anyone know the cause of this problem or how to work around it?


Just like an update, thanks to artem for the note on 'use strict';

, I added that to the top of node_modules / codeceptjs / lib / mocha_factory.js and that I think got me going through the initial issue. However, I now see the problem in node_modules / codeceptjs / lib / output.js. Mistake...

codeceptjs
/usr/local/lib/node_modules/codeceptjs-nightmare/node_modules/codeceptjs/lib/output.js:139
function print(...msg) {
               ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/codeceptjs-nightmare/node_modules/codeceptjs/lib/event.js:3:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

      

... I've tried several things to fix this by adjusting the print function there, but no luck so far.

This is similar to the codeceptjs-nightmare and codeceptjs-webdriverio meta packages.

I would be grateful for any ideas, suggestions or alternatives anyone has.

+3


source to share


1 answer


The second issue is related to the outdated version of Node. The spread operator (the error ...

you are seeing) is supported in Node 5.12.0 and later: http://node.green/#ES2015-syntax-spread-------operator



I'm not sure what is the best way for you to upgrade from Ubuntu, but that should fix your problem.

+2


source







All Articles