nightscout / cgm-remote-monitor

nightscout web monitor
GNU Affero General Public License v3.0
2.42k stars 71.76k forks source link

[Debian] language detection: cannot open translations/undefined.json #7946

Open emperor06 opened 1 year ago

emperor06 commented 1 year ago

Your setup information Fresh Debian 11.6 nodejs 14.21.03 Nightscout 14.2.6 (head)

The error Nightscout does not start, giving the following error:

Error: ENOENT: no such file or directory, open './translations/undefined.json'
    at Object.openSync (fs.js:498:3)
    at Object.readFileSync (fs.js:394:35)
    at Function.loadLocalization (/opt/nightscout/cgm-remote-monitor/lib/language.js:149:18)
    at Object.<anonymous> (/opt/nightscout/cgm-remote-monitor/lib/server/server.js:33:10)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: './translations/undefined.json'

I symlinked translations/fr_FR.json to translations/undefined.json and now it works. With the same install procedure, I didn't get this issue on Ubuntu 22.04.

Additional context I have no idea how the language is detected but if it helps, here are the locale for Debian (bug) and Ubuntu (works): Debian:

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Ubuntu:

LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=
tfnab commented 1 year ago

I ran into the same issue. Unsetting the LANGUAGE environment variable in my start script did the trick for me.