Error in update-translation.js

I used to update the translation for some time now using the following command:

sudo node update-translation.js main-ar.json

However, this time it is giving me the following error:

throw err;

SyntaxError: /usr/share/jitsi-meet/lang/main.json: Unexpected end of JSON input
at JSON.parse ()
at Object.Module._extensions…json (module.js:671:27)
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. (/usr/share/jitsi-meet/lang/update-translation.js:6:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)

How to trace and rectify the error please?


Oh, that’d odd. Can you please open an issue on GH?

I can’t reproduce with npm 8.1.0 / node 16.13.
Try the old cure for all npm woes: remove node_modules directory, npm install, retry, if it still fails update npm, remove node_modules, npm install, retry. If it still fails, well, you are sad and create a Github issue.
BTW you know you should not run non system software as root yes ?

As a more positive note, I’ll be remiss not to shill my tool that has the following advantages over the native one: it removes obsolete keys, instead of setting the new keys as empty values it adds the reference values preceded by ‘!!’ so you don’t need to look them up in the original file. And you don’t use node or run as root.

Thank you so much, the issue was solved.
I am using LeafPad over ssh to copy/past main.jason, and it seems that it does not save the full file code on the server, so it is always truncated :frowning:
When I used gedit, the file (main.jason) was fully saved on server and no error was reported :wink:

I’d take a PR which improves the tool :slight_smile: It should already be removing obsolete keys because it’s generated from scratch, based on the reference language, English. Ideally I’d like to make it interactive and ask the user for the translation while printing the English one.

Now, requiring Node is intentional since it keeps our tools in a single language / paradigm.

There is no need for being root anywhere.