Yarn build results in "error Command failed with exit code 1." error

Hi Experts,
I am trying to build my cutome kibana pluging using yarn build and getting "error Command failed with exit code 1." error . Can someone please assist me on how I can fix it ?

[@kbn/optimizer/node] GET error [sourceMaps/6ba17a6a:node:internal/streams/end-of-stream]: Error: Invalid parameter, which on MacOS is often due to more transactions than available robust locked semaphors (see docs for more info)
    at renewReadTxn (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:143:18)
    at LMDBStore.getString (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:423:58)
    at LMDBStore.get (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:445:22)
    at Cache.safeGet (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/cache.js:128:24)
    at Cache.getSourceMap (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/cache.js:105:22)
    at Array.retrieveSourceMap (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/node_auto_tranpilation.js:162:25)
    at /opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:65:24
    at mapSourcePosition (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:196:21)
    at wrapCallSite (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:377:20)
    at prepareStackTrace (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:426:39)
    at Function.csPrepareStackTrace (/opt/tryfour/kibana/node_modules/error-callsites/index.js:52:10)
    at maybeOverridePrepareStackTrace (node:internal/errors:141:29)
    at prepareStackTrace (node:internal/errors:115:5)
    at checkError (node:internal/streams/destroy:19:9)
    at Transform.destroy (node:internal/streams/destroy:49:3)
    at Object.destroyer (node:internal/streams/destroy:313:59)
[@kbn/optimizer/node] GET error [sourceMaps/6ba17a6a:node:internal/errors]: Error: Invalid parameter, which on MacOS is often due to more transactions than available robust locked semaphors (see docs for more info)
    at renewReadTxn (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:143:18)
    at LMDBStore.getString (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:423:58)
    at LMDBStore.get (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:445:22)
    at Cache.safeGet (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/cache.js:128:24)
    at Cache.getSourceMap (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/cache.js:105:22)
    at Array.retrieveSourceMap (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/node_auto_tranpilation.js:162:25)
    at /opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:65:24
    at mapSourcePosition (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:196:21)
    at wrapCallSite (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:377:20)
    at prepareStackTrace (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:426:39)
    at Function.csPrepareStackTrace (/opt/tryfour/kibana/node_modules/error-callsites/index.js:52:10)
    at maybeOverridePrepareStackTrace (node:internal/errors:141:29)
    at prepareStackTrace (node:internal/errors:115:5)
    at checkError (node:internal/streams/destroy:19:9)
    at Transform.destroy (node:internal/streams/destroy:49:3)
    at Object.destroyer (node:internal/streams/destroy:313:59)
   │ERROR failure 0 sec
   │ERROR Error: Premature close
   │          at new NodeError (node:internal/errors:371:5)
   │          at Socket.onclose (node:internal/streams/end-of-stream:135:30)
   │          at Socket.emit (node:events:402:35)
   │          at Pipe.<anonymous> (node:net:687:12)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Can you delete the data/node_auto_transpilation_cache_v3 directory and see if that helps? Also stop any command that you were running when this error shows up.

Thanks a lot @Marius_Dragomir ,

I delete the "node_auto_transpilation_cache_v3" directory from data folder; however I am still getting below mentioned error

   '/opt/tryfour/kibana/build/kibana/x-pack/plugins/drilldowns/url_drilldown/target/public/metrics.json',
   │        '/opt/tryfour/kibana/build/kibana/plugins/mycustom_test_plugin/target/public/metrics.json'
   │      ]
   │ debg Deleted 121 files/directories
   │ succ ✓ 35 min 8 sec

 info [  kibana  ] Transpiling sources with babel
[@kbn/optimizer/node] GET error [sourceMaps/6ba17a6a:node_modules/babel-plugin-add-module-exports/lib/index.js]: Error: Invalid parameter, which on MacOS is often due to more transactions than available robust locked semaphors (see docs for more info)
    at renewReadTxn (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:143:18)
    at LMDBStore.getString (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:423:58)
    at LMDBStore.get (/opt/tryfour/kibana/node_modules/lmdb-store/index.js:445:22)
    at Cache.safeGet (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/cache.js:128:24)
    at Cache.getSourceMap (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/cache.js:105:22)
    at Array.retrieveSourceMap (/opt/tryfour/kibana/node_modules/@kbn/optimizer/target_node/node/node_auto_tranpilation.js:162:25)
    at /opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:65:24
    at mapSourcePosition (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:196:21)
    at wrapCallSite (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:377:20)
    at prepareStackTrace (/opt/tryfour/kibana/node_modules/source-map-support/source-map-support.js:426:39)
    at Function.csPrepareStackTrace (/opt/tryfour/kibana/node_modules/error-callsites/index.js:52:10)
    at maybeOverridePrepareStackTrace (node:internal/errors:141:29)
    at prepareStackTrace (node:internal/errors:115:5)
    at extendedTrace (/opt/tryfour/kibana/node_modules/@babel/template/lib/builder.js:68:15)
    at /opt/tryfour/kibana/node_modules/@babel/template/lib/builder.js:25:14
    at addModuleExportsDefaults (/opt/tryfour/kibana/node_modules/babel-plugin-add-module-exports/lib/index.js:30:29)
[BABEL] Note: The code generator has deoptimised the styling of /opt/tryfour/kibana/build/kibana/x-pack/plugins/canvas/shareable_runtime/build/kbn_canvas.js as it exceeds the max of 500KB.

Also , I have noticed that the directory node_auto_transpilation_cache_v3 created again while running the yarn build cmd

Do you know the consequence of deleting the kibana/node_modules/@kbn/optimizer directory ?