类型错误:无法读取未定义的属性(读取"路径")



我正试图使用此代码生成NFT,但一直在获取未定义读取路径的无法读取属性,如果有人知道修复,请回信。我对整个过程很陌生,不知道我应该看什么,我一直在按照我正在观看的youtube视频中所述的步骤进行,而这个问题并没有发生在视频中的人身上。

const path = require("path");
const isLocal = typeof process.pkg === "undefined";
const basePath = isLocal ? process.cwd() : path.dirname(process.execPath);
const { MODE } = require(path.join(basePath, "constants/blend_mode.js"));
const { NETWORK } = require(path.join(basePath, "constants/network.js"));
const network = NETWORK.sol;
// General metadata for Ethereum
const namePrefix = "CHUMPSNFT";
const description = "2,222 Chumps storming Solana Beaches";
const baseUri = "ipfs://NewUriToReplace";
const solanaMetadata = {
symbol: "CHUMP",
seller_fee_basis_points: 700, // Define how much % you want from secondary market sales 1000 = 10%
external_url: "https://www.loosebucks.net",
creators: [
{
address: "HXzaa6foNqG3w7XaVykaH6jWAFpNkCfJeDyhXsih2U93",
share: 100,
},
],
};
// If you have selected Solana then the collection starts from 0 automatically
const layerConfigurations = [
{
growEditionSizeTo: 163,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Top" },
{ name: "Accessories" },
{ name: "Face" },
{ name: "Head" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 326,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Face" },
{ name: "Head" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 489,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Top" },
{ name: "Accessories" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 652,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Accessories" },
{ name: "Face" },
{ name: "Head" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 815,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Accessories" },
{ name: "Head" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 978,
layersOrder: [
{ name: "Background1" },
{ name: "Body Color1" },
{ name: "Top1" },
{ name: "Accessories1" },
{ name: "Face1" },
{ name: "Head1" },
{ name: "Eyes1" },
],
},
{
growEditionSizeTo: 1141,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Top" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 1304,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Accessories" },
{ name: "Face" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 1467,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 1630,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Face" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 1793,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Top" },
{ name: "Head" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 1956,
layersOrder: [
{ name: "Background" },
{ name: "Body Color" },
{ name: "Accessories" },
{ name: "Eyes" },
],
},
{
growEditionSizeTo: 2119,
layersOrder: [
{ name: "Background1" },
{ name: "Body Color1" },
{ name: "Accessories1" },
{ name: "Eyes1" },
],
},
{
growEditionSizeTo: 2282,
layersOrder: [
{ name: "Background1" },
{ name: "Body Color1" },
{ name: "Top1" },
{ name: "Accessories1" },
{ name: "Face1" },
{ name: "Eyes1" },
],
},
];
const shuffleLayerConfigurations = false;
const debugLogs = false;
const format = {
width: 512,
height: 512,
};
const text = {
only: false,
color: "#ffffff",
size: 20,
xGap: 40,
yGap: 40,
align: "left",
baseline: "top",
weight: "regular",
family: "Courier",
spacer: " => ",
};
const pixelFormat = {
ratio: 2 / 128,
};
const background = {
generate: true,
brightness: "80%",
static: false,
default: "#000000",
};
const extraMetadata = {};
const rarityDelimiter = "#";
const uniqueDnaTorrance = 10000;
const preview = {
thumbPerRow: 5,
thumbWidth: 50,
imageRatio: format.width / format.height,
imageName: "preview.png",
};
module.exports = {
format,
baseUri,
description,
background,
uniqueDnaTorrance,
layerConfigurations,
rarityDelimiter,
preview,
shuffleLayerConfigurations,
debugLogs,
extraMetadata,
pixelFormat,
text,
namePrefix,
network,
solanaMetadata,
}; ```

确保层中资产的命名正确(只使用下划线、a到z和hashtag(。此外,任何文件夹都不应为空

祝好运

在图层文件夹中的图像命名中,您是否使用了除下划线字母a到z和标签之外的其他任何东西。如果是这样的话,这可能就是你出错的原因。

我也遇到了同样的问题。原来一个图层文件夹是空的,我把图像保存在另一个路径上,我以为是同一个。

在图层文件夹中,检查是否保存了图像,或者路径是否符合您的想法。

相关内容

  • 没有找到相关文章

最新更新