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

163
Vistas
i get 'Joi.object.keys is not a function' error message from nodemon when i try to use .keys()

When i try to use joi.object.keys i get error.I used joi.object.keys function in my previous project but i did not get any error.

const checkSchema = Joi.object.keys({ // error is here
email: Joi.string().email({ minDomainSegments: 2 }),
password: Joi.string().pattern(new RegExp('^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$')),
confirmPassword: Joi.string().valid(Joi.ref('password')).required(),

});

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

There is a possibility that you might be using old version of JOI in your previous projects. In their latest documentation they have removed the object keyword when initializing. You should try this:

const Joi = require("joi");
const checkSchema = Joi.object().keys({ // I changed here
  email: Joi.string().email({ minDomainSegments: 2 }),
  password: Joi.string().pattern(
    new RegExp(
      "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$"
    )
  ),
  confirmPassword: Joi.string().valid(Joi.ref("password")).required(),
});

Documentation Link: https://joi.dev/api/?v=17.4.2

about 4 years ago · Juan Pablo Isaza Denunciar

0

May be due to version change. Have you tried Joi.object().keys({.......})?. This will work. Also please share your version if the above solution didn't work

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