gpt4 book ai didi

node.js - 类型错误 : Cannot read properties of undefined (reading 'path' )

转载 作者:行者123 更新时间:2023-12-05 04:42:24 26 4
gpt4 key购买 nike

我正在尝试使用此代码生成 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 和主题标签以外的任何其他内容。如果是这样,这可能是您收到错误的原因。

关于node.js - 类型错误 : Cannot read properties of undefined (reading 'path' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69860302/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com