h5p-cli-master Syntax Error

villon's picture
Forums: 

Sers

I have installed the latest cli-master to try it out and see if I can edit various H5P files. Unfortunately I get the following error message after loading any H5P file. Can I please get a hint on what I have to change here in the cli.js to make it work?

/home/josef/Schreibtisch/H5P_Testgelände/h5p-cli-master/h5p-cli/cli.js:261
        const data = help.match(new RegExp(regexp, 's'))?.[0];
                                                         ^
SyntaxError: Unexpected token '.'

    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:85:18)
    at Object.<anonymous> (/home/josef/Schreibtisch/H5P_Testgelände/h5p-cli-master/h5p-cli/h5p.js:14:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Thanks villon

 

otacke's picture

Hi Villon!

Could you please describe how exactly you're using the H5P CLI tool? Your post leads me to believe that you downloaded a zip archive of the code from github directly (`h5p-cli-master`) instead of following the instructions in the README. Not saying one cannot do it that way, but it might not be what you really intended to do.

On the other hand, you also have some `h5p-cli`folder inside the other folder.

On top, the line that you reference would only be invoked if you run `h5p help` followed by a command name. The error message could indicate that you're using a very outdated version of node.js (< 12) that does not support optional chaining. You could check that as well.

So in total, your post may not give anyone enough information to help you out.

Best,
Oliver

villon's picture

Hi Oliver,

thanks for the fast reply. And sure you was right. Outdated version of node.js brought the solution.

Greetings  villon

 

otacke's picture

Glad I could help.