Overleaf: TypeError: i18n.use is not a function on Ubuntu 18.04

Created on 18 Aug 2020  路  6Comments  路  Source: overleaf/overleaf

I have used the docker-compose.yml template provided to launch a sharelatex instance. Its able to connect to mongodb and redis which is runing outside the docker container. I have forwarded http port to 5000 inside the docker-compose.yml

But I am getting 502 Bad Gateway repetitively .

In web.log I saw two packages i18next-fs-backend i18next-http-middleware were not present.
So I did cd /var/www/sharelatex and installed these two packeges through npm.

Now I see the following error

/var/www/sharelatex/web/node_modules/translations-sharelatex/app/js/translations.js:12
      .use(fsBackend)
       ^

TypeError: i18n.use is not a function
  at Object.setup (/var/www/sharelatex/web/node_modules/translations-sharelatex/app/js/translations.js:12:8)
  at Object.<anonymous> (/var/www/sharelatex/web/app/src/infrastructure/Server.js:31:57)
  at Module._compile (internal/modules/cjs/loader.js:778:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
  at Module.load (internal/modules/cjs/loader.js:653:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  at Module.require (internal/modules/cjs/loader.js:692:17)
  at require (internal/modules/cjs/helpers.js:25:18)
  at Object.<anonymous> (/var/www/sharelatex/web/app.js:26:16)
  at Module._compile (internal/modules/cjs/loader.js:778:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
  at Module.load (internal/modules/cjs/loader.js:653:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
  at startup (internal/bootstrap/node.js:283:19)
  at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Most helpful comment

Thanks for the reports, this should be now fixed. Please pull the latest sharelatex/sharelatex:latest image (or sharelatex/sharelatex:2.4.1)

All 6 comments

It seems that I have the same error, running also mongo and redis in a docker container.

Reproduced with Ubuntu 20.04 too.

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'i18next-fs-backend'
  at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
  at Function.Module._load (internal/modules/cjs/loader.js:562:25)
  at Module.require (internal/modules/cjs/loader.js:692:17)
  at require (internal/modules/cjs/helpers.js:25:18)
  at Object.<anonymous> (/var/www/sharelatex/web/node_modules/translations-sharelatex/app/js/translations.js:2:19)
  at Module._compile (internal/modules/cjs/loader.js:778:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
  at Module.load (/var/www/sharelatex/web/node_modules/redis-sharelatex/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  at Module.require (internal/modules/cjs/loader.js:692:17)
  at require (internal/modules/cjs/helpers.js:25:18)
  at Object.<anonymous> (/var/www/sharelatex/web/node_modules/translations-sharelatex/index.js:1:18)
  at Module._compile (internal/modules/cjs/loader.js:778:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
  at Module.load (/var/www/sharelatex/web/node_modules/redis-sharelatex/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  at Module.require (internal/modules/cjs/loader.js:692:17)
  at require (internal/modules/cjs/helpers.js:25:18)
  at Object.<anonymous> (/var/www/sharelatex/web/app/src/infrastructure/Server.js:31:22)
  at Module._compile (internal/modules/cjs/loader.js:778:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
  at Module.load (internal/modules/cjs/loader.js:653:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  at Module.require (internal/modules/cjs/loader.js:692:17)
  at require (internal/modules/cjs/helpers.js:25:18)
  at Object.<anonymous> (/var/www/sharelatex/web/app.js:26:16)
  at Module._compile (internal/modules/cjs/loader.js:778:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
  at Module.load (internal/modules/cjs/loader.js:653:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
  at startup (internal/bootstrap/node.js:283:19)
  at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Same error here on current docker build. Workaround for now in docker is to install the npm package "i18next-fs-backend"

cd /var/www/sharelatex/web/ && npm install i18next-fs-backend

Tried that earlier. Installed both i18next-fs-backend and i18next-http-middleware. Got TypeError: i18n.use is not a function as mentioned in the first post.

Hi folks,

Thanks for the report. We are investigating, and will get this fixed as soon as we can.

Thanks for the reports, this should be now fixed. Please pull the latest sharelatex/sharelatex:latest image (or sharelatex/sharelatex:2.4.1)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BenediktBertsch picture BenediktBertsch  路  8Comments

ghuser221 picture ghuser221  路  4Comments

vitorbaptista picture vitorbaptista  路  8Comments

ShellCode33 picture ShellCode33  路  4Comments

marcAC picture marcAC  路  6Comments