'How do I fix Enoent nft base on windows

i have this problem that keeps me from going from here.

errno: -4058,

syscall: 'scandir',

code: 'Enoent',

path: '${basePath}/build/images'

Is the current thing that pops up when i run

node utils/nftport/Upload.js

this is the code im working on

const FormData = require("form-data");
const fetch = require("node-fetch");
const path = require("path")
const basePath = process.cwd();
const fs = require("fs");

fs.readdirSync('${basePath}/build/images').forEach(file => {
const formData = new FormData();
const fileStream = fs.createReadStream('${basePath}/build/images/${file}');
formData.append("file",fileStream);

let url = 'https://api.nftport.xyz/v0/files';

let options = {
  method: 'POST',
  headers: {
    Authorization: 'I deleted this on purpose',
  },
  body: formData
};

fetch(url, options)
  .then(res => res.json())
  .then(json => {
      const fileName = path.parse(json.file_name).name;
      let rawdata = fs.readFileSync('${basePAth}/build/j/${fileName}.json')
      let metaData = JSON.parse(rawdata);

      metaData.file_url = json.ipfs_url;

      fs.writeFileSync('${basePath}/build/json/${fileName}.json',JSON.stringify(metaData, null, 2));

      console.log('${json.file_name} uploaded & ${fileName}.json updated!');
   })
  .catch(err => console.error("error:" + err));

});

The current verison im working with is

  haaslips_art_engine: 1.1.1,
  npm: 8.1.2
  node: 16.13.2

Ive been dealing with this for the past 2days and i did try to update it and uninstall and then reinstall



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source