0

When I run the following code:

const { dashdash } = require('dashdash');

const options = ....; //it's long so I replace them with ... to let me publish the post.

async function upload_photo() {
    const parser = dashdash.createParser({options: options});
    const opts = parser.parse(process.env);
    const path = opts.imagepath + "\\" + opts.imagenumber + "." + opts.imageformat;
    console.log("***********"+path+"************" + "\\" + opts.imagenumber + "." + opts.imageformat);
      const { latitude, longitude, searchQuery } = {
        latitude: 0.0,
        longitude: 0.0,
        // not required
        searchQuery: 'place',
      };

  const mediaLocation = locations[0];
  console.log(mediaLocation);

  const publishResult = await ig.publish.photo({

    file: await readFileAsync(path),
    // optional, default ''
    caption: 'Delicious food',

  });

  console.log(publishResult); 
}

(async () => {

    await login();
    await upload_photo();
    console.log('Succsess!');
    await logout();

})();

But I get the following error:

screenshot of the error

I searched the whole internet but I find nothing. How can I solve this?

Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72

1 Answers1

0

change

const { dashdash } = require('dashdash');

to

const dashdash = require('dashdash');
Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72