zotero/translation-server

`SyntaxError: Unexpected token .` in utilities submodule

Closed this issue · 3 comments

I just updated our translation-server instance for Manubot as follows:

git checkout -- package-lock.json
git pull --ff-only --recurse-submodules
# update just the translators submodule for the latest translatros
git submodule update --remote --merge modules/translators
npm install

Which upgraded translation-server to a30a15d and the utilities submodule to zotero/utilities@4d8d7d3.

However, we're now getting the following error on the translation server instance:

SyntaxError: Unexpected token .
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.Zotero.requireUtilities (/home/translate/translation-server/src/zotero.js:95:9)
2022-11-06 09:02:13,162: /home/translate/translation-server/modules/utilities/utilities.js:1661
				visitors.visitContainer?.(elem);

The line of code with the SyntaxError is from the utilities submodule here. It was added in zotero/utilities@a0a145a by @AbeJellinek.

Any ideas how to resolve this issue? Very well might be some configuration or version problem on our end... just not sure as not too familiar with JS development.

Downgrading to 65559e2 fixes the error for us. Noting commands to downgrade:

git checkout 65559e2a349e7cb19839577202fd6ebf7c1faa69
git submodule update --init
git submodule update --remote --merge modules/translators

Output of git submodule status:

 a9308c0e8632846ca2dc069a1b72db0a33f99ca6 modules/translate (heads/master-1-ga9308c0)
+23b2f425845b7cb9ab1c4a3425ddaddaedb9d156 modules/translators (3.0b1-4932-g23b2f425)
 9390fa2a4fd749688f2cf78e8a62a716643f4b90 modules/utilities (heads/master-5-g9390fa2)
 b5b3f51217a99b3c41585d468ee1dc0837233d13 modules/zotero-schema (b5b3f51)

But would still like to not be pinned to an old version of translation-server so worth figuring this out.

Oh, sorry. I added some code that uses a JavaScript feature that your Node environment predates. The feature in question has been supported by Node since version 14, released April 2020, and all earlier versions no longer receive security updates. So I’m tempted to say that you should just update Node - it’ll be good for security and will fix this error - but removing that use of “new” syntax is also an option. I’ll let @dstillman weigh in too.

The feature in question has been supported by Node since version 14, released April 2020, and all earlier versions no longer receive security updates.

Ah great to know! We'll update Node on our end.