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

322
Views
Error recurrente en la secuencia de comandos del generador de NFT Art, index.js: el ADN existe

No puedo encontrar la línea donde se llama al ADN, antes de agregar algunas líneas de código, el código se estaba ejecutando correctamente. Ahora el error se está ejecutando y no me deja salir de la ejecución.

Aquí está la línea donde se crea Dna en index.js. Veo que requiere razas variables y raza, pero no sé cómo las carreras hacen el ADN.

 const createDna = (_races, _race) => { let randNum = []; _races[_race].layers.forEach((layer) => { let randElementNum = Math.floor(Math.random() * 100) + 1; let num = 0; layer.elements.forEach((element) => { if (randElementNum >= 100 - element.weight) { num = element.id; } }); randNum.push(num); }); return randNum; };

Luego, en config.js aparece aquí la variable _races. No sé si lo que sigue del resto del código es importante para su respuesta, pero esto es lo que tengo hasta ahora...

 const fs = require("fs"); const width = 708; const height = 1080; const dir = __dirname; const description = "This is an NFT made by the coolest generative code."; const baseImageUri = "https://hashlips/nft"; const startEditionFrom = 1; const endEditionAt = 34; const editionSize = 34; const raceWeights = [ { value: "skull", from: 1, to: editionSize, }, ]; const races = { skull: { name: "skull", layers: [ { name: "Background", elements: [ { id: 0, name: "Light pink", path: `${dir}/1-background/PRDE_0008s_0000_Capa-5.png`, weight: 100, }, ] // etc... ] }

Cuando rompo la ejecución, el proceso sale con este mensaje

 Uncaught TypeError: Cannot read properties of undefined (reading 'layers')

y solo produce 24 capas de pngs del total de 34 que le pedí que produjera. ¿Qué ocurre?

about 4 years ago · Juan Pablo Isaza
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!