title: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
body: <p>I do according to the lesson from <a href="https://github.com/UniqueNetwork/nft-workshop" rel="nofollow noreferrer">https://github.com/UniqueNetwork/nft-workshop</a>
  step 5
  I'm writing a command &quot;node nft-generator.js&quot;
  this error appears</p>
  <pre><code>Possible combinations: 405
  node:internal/fs/utils:670
      throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
      ^
  
  TypeError [ERR_INVALID_ARG_TYPE]: The &quot;path&quot; argument must be of type string or an instance of Buffer or URL. Received undefined
      at Object.mkdirSync (node:fs:1329:10)
      at generateNFTs (C:\Users\wasab\Desktop\nft\nft-workshop-master\nft-generator.js:64:8)
      at main (C:\Users\wasab\Desktop\nft\nft-workshop-master\nft-generator.js:112:3)
      at Object.&lt;anonymous&gt; (C:\Users\wasab\Desktop\nft\nft-workshop-master\nft-generator.js:116:1)
      at Module._compile (node:internal/modules/cjs/loader:1103:14)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
      at Module.load (node:internal/modules/cjs/loader:981:32)
      at Function.Module._load (node:internal/modules/cjs/loader:822:12)
      at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
      at node:internal/main/run_main_module:17:47 {
    code: 'ERR_INVALID_ARG_TYPE'
  </code></pre>
  <p>file &quot;nft-generator.js&quot;</p>
  <pre><code>const fs = require(&quot;fs&quot;);
  var BigNumber = require('bignumber.js');
  const config = require('./config');
  const attributes = require('./attributes');
  
  function getRandomInt(max) {
    return BigNumber.random(20).multipliedBy(max).integerValue();
  }
  
  function codeToArray(code) {
    let arr = [];
  
    for (let i=attributes.length-1; i&gt;=0; i--) {
  
      // property gets the actual value of property i...
      let property = parseInt(code.mod(attributes[i].count).toFixed());
  
      // If this is a required property, the actual value ranges from 1 to attributes[i].count, so that required properties are never 0
      if (attributes[i].required) {
        arr[i] = property+1;
      }
      // If this is an optional property, the actual value ranges from 0 to attributes[i].count. 0 means this trait is not present
      else {
        arr[i] = property;
      }
      code = code.minus(arr[i]).dividedBy(attributes[i].count).integerValue();
    }
  
    return arr;
  }
  
  function bnIncludes(arr, bn) {
    for (let i=0; i&lt;arr.length; i++) {
      if (arr[i].eq(bn)) return true;
    }
    return false;
  }
  
  function generateNFTs() {
    // Get a bigint of possible combinations
    let combinations = new BigNumber(1);
    for (let i=0; i&lt;attributes.length; i++) {
      combinations = combinations.multipliedBy(attributes[i].required ? attributes[i].count : (attributes[i].count + 1));
    }
    console.log(`Possible combinations: ${combinations.toString()}`);
  
    // generate desired count of different random numbers in the range
    let faceCodes = [];
    while (faceCodes.length &lt; config.desiredCount) {
      let code = getRandomInt(combinations);
      if (!bnIncludes(faceCodes, code))
        faceCodes.push(code);
    }
  
    // Convert generated codes into NFT properties
    let faces = [];
    for (let i=0; i&lt;faceCodes.length; i++) {
      let arr = codeToArray(faceCodes[i]);
      faces.push(arr);
    }
  
    // Save faces
    if (!fs.existsSync(config.outputFolder)){
      fs.mkdirSync(config.outputFolder);
    }
    fs.writeFileSync(`${config.outputFolder}/${config.outputJSON}`, JSON.stringify(faces));
  }
  
  /**
   * Generate protobuf JSON schema
   */
  function generateSchema() {
    // Empty schema
    let schema = {
      nested: {
        onChainMetaData: {
          nested: {
            NFTMeta: {
              fields: {
                traits: {
                  id: 1,
                  rule: 'repeated',
                  type: 'FireballTrait'
                }
              }
            },
            FireballTrait: {
              options: {
              },
              values: {
              }
            }
          }
        }
      }
    };
  
    // Fill schema with attributes (traits)
    let value = 0;
    for (let i=0; i&lt;attributes.length; i++) {
      for (let j=0; j&lt;attributes[i].count; j++) {
        schema.nested.onChainMetaData.nested.FireballTrait.options[`PROP_${value}`] = `{&quot;en&quot;: &quot;${attributes[i].attrNames[j]}&quot;}`;
        schema.nested.onChainMetaData.nested.FireballTrait.values[`PROP_${value}`] = value;
        value++;
      }
    }
  
    fs.writeFileSync(`${config.outputFolder}/${config.outputSchema}`, JSON.stringify(schema));
  }
  
  function main() {
    generateNFTs();
    generateSchema();
  }
  
  main();
  </code></pre>
  <p>im try:</p>
  <ol>
  <li><p>Delete node_modules folder</p>
  </li>
  <li><p>Delete package-lock.json file</p>
  </li>
  <li><p>Rewrite the package.json file from &quot;react-scripts&quot;: &quot;3.x.x&quot; to &quot;react-scripts&quot;: &quot;^3.4.1&quot;</p>
  </li>
  <li><p>Install node packages again npm i</p>
  <p>how to fix it</p>
  </li>
  </ol>