Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

335
Views
error:ReferenceError: upload is not defined error:TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

so ive been trying to do an nft collection by a video from youtube ( i dont know nothing in coding ) and it keep giving me this error:

' error:ReferenceError: upload is not defined error:TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined '

How can i resolve it?

I had a previous error that i resolved by installing npm i node-fetch@2.6.1

Anyways, know i have this one and just cant go anyfurther,

Would appreciate any help, THANK YOU

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 = '';

 let options = {
   method: 'POST',
   headers: {
    Authorization: '',
  },
  body: formData
 };

 options.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/json/${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 & ${upload}.json
    updated!`);
  })
  .catch((err) => console.error('error:' + err));
});```
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!