Uncaught Error: Mismatched anonymous define() module: function() {return uuid;}

387 Views Asked by At

I have installed pinata SDK using

npm install --save @pinata/sdk

I’m implementing the code to add files to IPFS using pinata

const pinataSDK= require('@pinata/sdk');
const pinata = pinataSDK('812f8a2d416d9be9afea',  '668516ac85834685ed785bcaec839f5ad1aeca099788cd8aa814ccdbad77d1bb');
    console.log("entered");
pinata.testAuthentication().then((result) => {
    //handle successful authentication here
    console.log(result);
}).catch((err) => {
    //handle error here
    console.log(err);
});

const fs = require('fs');
const readableStreamForFile = fs.createReadStream('./naruto6.jpeg');
const options = {
    pinataMetadata: {
        name: MyCustomName,
        keyvalues: {
            customKey: 'customValue',
            customKey2: 'customValue2'
        }
    },
    pinataOptions: {
        cidVersion: 0
    }
};
pinata.pinFileToIPFS(readableStreamForFile, options).then((result) => {
    //handle results here
    console.log(result);
}).catch((err) => {
    //handle error here
    console.log(err);
});

I’m facing the following error.

https://requirejs.org/docs/errors.html#notloaded

https://requirejs.org/docs/errors.html#mismatch enter image description here

I have installed the require.js node module. I could not understand the error properly. I'm new to js. Please help me out.

0

There are 0 best solutions below