Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
"La expresión del método no es del tipo Función"

Tengo el siguiente código JavaScript:

 const { Command } = require('commander'); const program = new Command(); const createPassword = require('./createPassword') program.version('1.0.0').description('Commandline Password Generator'); program .option('-l, --length <number>', "Length of your Password", '8') .option('-nn, --no-numbers', "Remove Numbers") .option('-ns, --no-symbols', "Remove Symbols") .option('-s, --save', "Save Password to passwords.txt") .parse(); const { length, save, numbers, symbols } = program.opts(); // Get generated Password const generatedPassword = createPassword(length, numbers, symbols);

El archivo "createPassword" se ve así:

 const alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; const numbers = '1234567890' const symbols = '!@#$%^&*_-+=' let createPassword = (length = 9, hasNumbers = true, hasSymbols = true) => { let chars = alpha; hasNumbers ? (chars += numbers) : ''; hasSymbols ? (chars += symbols) : ''; return chars; } module.exports = createPassword();

La salida es la siguiente:

 const generatedPassword = createPassword(length, numbers, symbols); ^ TypeError: createPassword is not a function

Sé que esta pregunta se hizo hace unos 6 o 7 años y probé todo, pero simplemente no funciona. Node está instalado en la versión actual y también jQuery.

¿Qué diablos estoy haciendo mal?

ingrese la descripción de la imagen aquí

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!