Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: data.forEach is not a function #685

Open
ghost opened this issue Feb 6, 2022 · 12 comments
Open

TypeError: data.forEach is not a function #685

ghost opened this issue Feb 6, 2022 · 12 comments

Comments

@ghost
Copy link

ghost commented Feb 6, 2022

No description provided.

@bolshoytoster
Copy link

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

@bolshoytoster
Copy link

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

@bolshoytoster
Copy link

@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
Copy link

@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
Copy link

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

@Las499
Copy link

Las499 commented Mar 13, 2022

Having this same issue.

@bolshoytoster
Copy link

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

@Las499
Copy link

Las499 commented Mar 13, 2022

{
"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
Copy link

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

@Las499
Copy link

Las499 commented Mar 13, 2022

@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
Copy link

Las499 commented Mar 13, 2022

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants