Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
How Fix deploy nodejs in ubuntu

I have a very strange error and I don't know how to solve it.

I'm trying to publish my system to an Ubuntu 18.04 server.

I installed NODEJS and NPM, the versions that are on the server are: NODEJS - v10.19.0 NPM - 6.14.4

My backend works all normal on my local machine, after I published it on Ubuntu's online server it started to get this error:

  init = ({ app } = {}) => {
       ^

SyntaxError: Unexpected token =
    at Object.compileFunction (vm.js:406:10)
    at Generator.next (<anonymous>)
    at Object.<anonymous> (/var/www/backend.io/src/index.js:1)
    at Generator.next (<anonymous>)

My file full is :

const i18next = require("i18next");
const Backend = require("i18next-node-fs-backend");
const i18nextMiddleware = require("i18next-express-middleware");

class I18nManager {
  t;
  currentLang;
  init = ({ app } = {}) => {
    i18next
      .use(Backend)
      .use(i18nextMiddleware.LanguageDetector)
      .init({
        backend: {
          loadPath: "locales/{{lng}}/{{ns}}.json",
        },
        fallbackLng: "en",
        preload: ["en", "pt-br"],
      })
      .then((_t) => (this.t = _t));

    if (app) app.use(i18nextMiddleware.handle(i18next));
  };
}

const i18n = new I18nManager();

module.exports = {
  i18n,
  t: (...args) => i18n.t(...args),
  currentLang: () => i18next.language,
};
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The syntax you are using requires Node.js 12.

Node.js 10 is no longer supported anyway. Upgrade.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda