Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda