HashLips / hashlips_art_engine

HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
MIT License
7.17k stars 4.3k forks source link

TypeError: data.forEach is not a function #685

Open ghost opened 2 years ago

bolshoytoster commented 2 years ago

@Erlhyenaplays can you copy/paste the full error please?

bolshoytoster commented 2 years ago

@Erlhyenaplays it looks like something is wrong with the /build/json/_metadata.json file. Could you paste the contents of that here?

bolshoytoster commented 2 years ago

@Erlhyenaplays I have no idea how it happened, but you could fix it by changing line 17 of utils/update_info.js from data.forEach((item) => { to data.collection.forEach((item) => {.

0xitsHimanshu commented 2 years ago

@Erlhyenaplays I have no idea how it happened, but you could fix it by changing line 17 of utils/update_info.js from data.forEach((item) => { to data.collection.forEach((item) => {.

its still not working for me. its just showing this

TypeError: Cannot read properties of undefined (reading 'forEach') at Object. (C:\Users\HIMANSHU\Generative_art\hashlips_art_engine-main\utils\update_info.js:17:17) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47

bolshoytoster commented 2 years ago

@0xitsHimanshu can you paste one of your json files please.

Las499 commented 2 years ago

Having this same issue.

bolshoytoster commented 2 years ago

@Las499 can you paste one of your metadata files please.

Las499 commented 2 years ago

{ "name": "GrimCat #1", "description": "A cute, grumpy GrimCat! Unique and ready for a new home!", "file_url": "ipfs://NewUriToReplace/1.png", "custom_fields": { "dna": "dcee29c44db1ff3b85ba83ab5d104220738cae62", "edition": 1, "date": 1646532832718, "compiler": "HashLips Art Engine" }, "external_url": "https://lefluffy.com/nfts", "attributes": [ { "trait_type": "Background", "value": "Yellow" }, { "trait_type": "Tail Color", "value": "Tail6" }, { "trait_type": "Tail Accessory", "value": "devil 4" }, { "trait_type": "Shirt Base Color", "value": "shirtbase1" }, { "trait_type": "Shirt Pattern", "value": "pattern 12" }, { "trait_type": "Arm Outer", "value": "arm" }, { "trait_type": "Hoodie Hood Color", "value": "Hoodie Color 4" }, { "trait_type": "Hoodie Accent Color", "value": "Hoodie Outline 2" }, { "trait_type": "Ears", "value": "inner ears" }, { "trait_type": "Arm Inner", "value": "armsinner" }, { "trait_type": "Face Base", "value": "faceoutline" }, { "trait_type": "Eyes", "value": "Yellow" }, { "trait_type": "Mouth Type", "value": "Skeleton Type" }, { "trait_type": "Neck Accessory", "value": "catcollar5" }, { "trait_type": "Head Accessory", "value": "japanesetriangle" }, { "trait_type": "Speech", "value": "plain 3" } ] }

bolshoytoster commented 2 years ago

@Las499 could you paste the first 10-20 lines of the _metadata.json file please.

Las499 commented 2 years ago

@Las499 could you paste the first 10-20 lines of the _metadata.json file please.

[ { "name": "GrimCat #1", "description": "A cute, grumpy GrimCat! Unique and ready for a new home!", "file_url": "ipfs://NewUriToReplace/1.png", "custom_fields": { "dna": "dcee29c44db1ff3b85ba83ab5d104220738cae62", "edition": 1, "date": 1646532832718, "compiler": "HashLips Art Engine" },

Las499 commented 2 years ago

@Las499 could you paste the first 10-20 lines of the _metadata.json file please.

[ { "name": "GrimCat #1", "description": "A cute, grumpy GrimCat! Unique and ready for a new home!", "file_url": "ipfs://NewUriToReplace/1.png", "custom_fields": { "dna": "dcee29c44db1ff3b85ba83ab5d104220738cae62", "edition": 1, "date": 1646532832718, "compiler": "HashLips Art Engine" },

@Las499 could you paste the first 10-20 lines of the _metadata.json file please.

This works, but it goes to the wrong place (appends to the end of the items attributes) Object.keys(data).forEach((item) => { if (network == NETWORK.sol) { item.name = ${namePrefix} #${item.edition}; item.description = description; item.creators = solanaMetadata.creators; } else { item.name = ${namePrefix} #${item.edition}; item.description = description; item.image = ${baseUri}/${item.edition}.png; } fs.writeFileSync( ${basePath}/build/json/${item.edition}.json, JSON.stringify(item, null, 2) ); });

bolshoytoster commented 2 years ago

@Las499 can you paste the error when it's data.forEach.