# Dev-tools - createTsProgram Error: EISDIR: illegal operation on a directory, read

**URL:** <https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290>\
**Category:** Bugs\
**Tags:** visual-editor, nextjs\
**Created:** [April 3, 2024, 8:43pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290 "2024-04-03T20:43:36Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![LucasMatuszewski](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/lucasmatuszewski/32/2130_2.png) [@LucasMatuszewski](https://forum.builder.io/u/LucasMatuszewski)\
**Post date:** [April 3, 2024, 8:43pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/1 "2024-04-03T20:43:36Z")

</div>

I have an error in Builder DevTools. We added it to an existing Builder project (we already had many components registered in Builder) to be able to register components for Visual Editor.

`npm init builder.io@latest` worked fine, after adding credentials to the project we have `.env` file created with API key, and the Counter component was created.

But the `builder-registry.ts` file is **empty**.

Error we get in Chrome Console:

```auto
POST http://localhost:5273/~builder-dev-tools
500 Internal Server Error

Payload:
{"type":"connectBuilder","data":{"publicApiKey":"50612480d3c642cea40342a99f4dc2b7","privateAuthKey":"bpk-xxxxx"}}

Response:
{
    "errors": [
        "createTsProgram() Could not create program for: /home/lucas/DEV/lewiscellars-nextjs/builder-registry.ts"
    ]
}

```

I get it many times in a loop.

And in the terminal when I started the app with `npm run dev` I get:

```auto
POST https://cdn.builder.io/api/v2/admin, duration: 552ms
GET https://cdn.builder.io/api/v3/data?limit=1&cachebust=true&collection=content&query.published.%24ne=archived&query.query.%24elemMatch.%24and%5B0%5D.property=urlPath&query.query.%24elemMatch.%24and%5B0%5D.operator=is&query.query.%24elemMatch.%24and%5B0%5D.value=%2Fbuilder-demo&query.modelId=453dd1daf33845e89904a7c7c523e463&apiKey=50612480d3c642cea40342a99f4dc2b7, duration: 323ms
^CcreateTsProgram Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:751:3)
    at tryReadSync (node:fs:451:20)
    at readFileSync (node:fs:497:19)
    at Object.readFileSync (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node/index.cjs:1:2346)
    at Object.getSourceFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:22:120)
    at findSourceFileWorker (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122233:25)
    at findSourceFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122152:22)
    at /home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122101:24
    at getSourceFileFromReferenceWorker (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122070:28)
    at processSourceFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122099:7)
    at processRootFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:121897:7)
    at /home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:120631:43
    at forEach (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:55:24)
    at Object.createProgram (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:120631:7)
    at eo (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:22:1496)
    at U (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:22:552)
    at async Xe (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:32:8332)
    at async M (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:32:8390)
    at async Do (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:230:203)
    at async dn (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:32:10267)
    at async V (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/server/index.cjs:7:3226)
    at async j (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/server/index.cjs:7:4574)
    at async X (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/server/index.cjs:199:985) {
  errno: -21,
  syscall: 'read',
  code: 'EISDIR'
}

```

And Builder DevTool’s UI told me:

```auto
Please Restart Your Dev Server
We've made updates to your application, please restart your dev server to ensure the changes take effect.

Once your dev server is restarted you'll be able to start editing your Builder content.

```

In Builder DevTools when I try to get into the `Components` tab in the right sidebar I get the same errors. I tried to add DevTools manually, without `init`, and got the same errors:

 ![2024-04-04_01-08](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/3/3317c07a4ec59b1f3b75d357a9850bb6942624bd.png)

The Error is thrown here: `/project-directory/node_modules/@builder.io/dev-tools/core/index.cjs` and it’s produced by this function: `e.ts.createProgram(n)` (which is probably TS build-in function which is added by Builder to `ts` object?).

The object passed as `n` is just our parsed TS config file with a list of all paths (instead of include/exclude) sorted alphabetically. It looks like this:

```auto
 rootNames: [
    '/app-directory/builder-registry.ts',
    '/app-directory/cypress.config.js',
    '/app-directory/cypress.d.ts',
    '/app-directory/globals.d.ts',
...
]

```

If I delete `builder-registry.ts` file (which is the first element in `rootNames`) I just get exactly the same error for the next file which is passed to Webpack in `rootNames`. If I delete that file, I get the same error for the next file from the list, and so on, probably for all files in our Project.

The order of paths is exactly the same as the order of errors I get when deleting files from our project (to validate if deleting the file will fix the error).

I tried it in another project, and it worked fine, I had Counter registered in `builder-registry.ts` file and I get also different info in DevTools UI with a list of changed files. So probably something is wrong with the configuration of our project. But after many hours I’m still not able to fix it… ☹

Some hypothesis I validated:

- write/read permissions to files and directories
- wrong paths in our next/ts configs
- wrong include/exclude setting in `tsconfig.json`
- Builder DevTools creates `.env` file with `NEXT_PUBLIC_BUILDER_API_KEY` for the env we Selected in Builder when authorizing the plugin, but we use `.envrc` file. But I make sure we have the same Env and it didn’t fixed anythig. BTW, Dev Tools will not work without `.env` file? (if I delete it it shows me configuration page again). So we need both `.env` and our `.envrc`?
- deleting the files which are “causing” errors (as mentioned before, I just get the same “createTsProgram() Could not create program” error for the next file from `rootNames`, which is an alphabetical list of all files in our project).
- deleting `.next` and `node_moedules` folders and installing/building again.
- cloning a new repo with our project in different place on my laptop and also on other laptop.
- validating on MacOS (the other person from my team has the same errors I have on Ubuntu)

**Builder public api key**  
50612480d3c642cea40342a99f4dc2b7

**Screenshots or video link**

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/2/2a464ca1381e9cf5f0a85a06d654248cf5e4b1a4.png)

**Code stack you are integrating Builder with**

```auto
"dependencies": {
    "@builder.io/dev-tools": "^1.0.1",
    "@builder.io/react": "^3.2.6",
    "@builder.io/sdk": "^2.2.2",
    "@builder.io/utils": "^1.1.19",
    "@floating-ui/react-dom": "^1.0.0",
    "@n8tb1t/use-scroll-position": "^2.0.3",
    "@sentry/nextjs": "^7.92.0",
    "@svgr/webpack": "^8.0.1",
    "@tanstack/react-query": "^4.35.3",
    "@tanstack/react-query-devtools": "^4.35.3",
    "@wonderful/wine-components": "^0.37.3",
    "@wonderful/wwc": "^3.37.0",
    "body-scroll-lock": "^3.1.5",
    "dayjs": "^1.11.10",
    "fromentries": "^1.3.2",
    "isomorphic-dompurify": "^1.2.0",
    "js-cookie": "^3.0.5",
    "jwt-decode": "^3.1.2",
    "next": "^12.3.4",
    "next-seo": "^6.0.0",
    "nextjs-cors": "^2.1.1",
    "nextjs-progressbar": "^0.0.16",
    "query-string": "^7.1.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-focus-lock": "^2.9.6",
    "react-hook-form": "^7.49.3",
    "react-to-print": "^2.14.7",
    "sass": "^1.69.7",
    "sharp": "^0.33.1",
    "swiper": "^9.3.2"
  },
  "devDependencies": {
    "@babel/core": "^7.23.7",
    "@next/bundle-analyzer": "^12.2.4",
    "@testing-library/cypress": "^10.0.1",
    "@types/body-scroll-lock": "^3.1.0",
    "@types/js-cookie": "^3.0.6",
    "@types/node": "^18.11.9",
    "@types/react": "^17.0.74",
    "@types/vimeo__player": "^2.16.3",
    "@types/webpack-env": "^1.17.0",
    "@typescript-eslint/eslint-plugin": "^5.32.0",
    "babel-loader": "^8.2.5",
    "babel-plugin-istanbul": "^6.1.1",
    "cypress": "^13.3.2",
    "cypress-localstorage-commands": "^2.2.4",
    "eslint": "^8.21.0",
    "eslint-config-next": "^12.2.4",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-import": "^2.27.5",
    "next-sitemap": "^4.2.3",
    "node-fetch": "^3.3.2",
    "prettier": "^2.8.7",
    "typescript": "^4.9.5",
    "util": "^0.12.5"
  }

```

---

<div class="post-metadata">

**Author:** ![LucasMatuszewski](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/lucasmatuszewski/32/2130_2.png) [@LucasMatuszewski](https://forum.builder.io/u/LucasMatuszewski)\
**Post date:** [April 3, 2024, 8:49pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/2 "2024-04-03T20:49:30Z")

</div>

I tried also to change ts `exclude/include` but it didn’t help:

```auto
  "include": [
    "cypress.d.ts",
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    "next-sitemap.config.mjs"
  ],
  "exclude": [
    "node_modules",
    "**/node_modules",
    "storybook",
    "cypress",
    "cypress.config.js",
    " **/*.ts/**",
    " **/*.tsx/**"
  ]

```

This is our current next.config.js

```auto
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const withBuilderDevTools = require('@builder.io/dev-tools/next')();
const { withSentryConfig } = require('@sentry/nextjs');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
});
const { REDIRECTS } = require('./config/redirects.json');
const moduleExports = withBundleAnalyzer({
  experimental: { esmExternals: true },
  webpack(config, { webpack, isServer }) {
    config.module.rules.push({
      test: /\.svg$/,
      use: ['@svgr/webpack'],
    });
    const isProdEnv = process.env.NEXT_PUBLIC_ENVIRONMENT === 'production';
    // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/tree-shaking/
    config.plugins.push(
      new webpack.DefinePlugin({
        __SENTRY_DEBUG__ : isProdEnv ? false : true,
        __SENTRY_TRACING__ : isProdEnv ? false : true,
      })
    );
    // only applies for `npm run dev`
    if (process.NODE_ENV !== 'production') {
      // When developing with symlink to a local @wonderful/wwc we get "can't resolve XYZ" errors (e.g. "can't resolve Canvas" error from jsdom).
      // Below packages are not required by our dependencies (optional dep) so we can ignore them locally:
      config.plugins.push(
        new webpack.IgnorePlugin({
          resourceRegExp: /canvas/,
          contextRegExp: /jsdom$/,
        }),
        new webpack.IgnorePlugin({
          resourceRegExp: /bufferutil/,
          contextRegExp: /ws\/lib$/,
        }),
        new webpack.IgnorePlugin({
          resourceRegExp: /utf-8-validate/,
          contextRegExp: /ws\/lib$/,
        })
      );
    }
    // Fix issues with react-query:
    // https://github.com/TanStack/query/issues/3595
    config.resolve.alias['@tanstack/react-query'] = path.resolve(
      './node_modules/@tanstack/react-query'
    );
    if (isServer) {
      config.externals = ['@tanstack/react-query', ...config.externals];
    }
    return config;
  },
  sassOptions: {
    includePaths: [path.join(__dirname, 'styles')],
  },
  i18n: {
    locales: ['en'],
    defaultLocale: 'en', // this adds lang="en" to <html>
  },
  sentry: {
    hideSourceMaps:
      process.env.NEXT_PUBLIC_ENVIRONMENT === 'production' ? true : false,
  },
  images: {
    domains: ['images.commerce7.com', 'cdn.builder.io'],
  },
  // If we want source maps provided with Sentry Errors we need this option enabled. But it will make production builds longer.
  // More about this option:
  // - https://nextjs.org/blog/next-11-1#source-maps
  // - https://nextjs.org/docs/advanced-features/source-maps
  productionBrowserSourceMaps: true,
  swcMinify: true, // 7 times faster minification.
  async redirects() {
    return REDIRECTS;
  },
  poweredByHeader: false,
});
const sentryWebpackPluginOptions = {
  // Additional config options for the Sentry Webpack plugin. Keep in mind that
  // the following options are set automatically, and overriding them is not
  // recommended:
  // release, url, org, project, authToken, configFile, stripPrefix,
  // urlPrefix, include, ignore
  silent: true, // Suppresses all logs in terminal
  debug: false,
  // For all available options, see:
  // https://github.com/getsentry/sentry-webpack-plugin#options.
};

module.exports = withBuilderDevTools(
  withSentryConfig(moduleExports, sentryWebpackPluginOptions)
);

```

---

<div class="post-metadata">

**Author:** ![LucasMatuszewski](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/lucasmatuszewski/32/2130_2.png) [@LucasMatuszewski](https://forum.builder.io/u/LucasMatuszewski)\
**Post date:** [April 3, 2024, 8:55pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/3 "2024-04-03T20:55:00Z")

</div>

BTW, other questions we have:

1. is it possible to use `builder-registry.tsx` (instead of `ts`)? Now it doesn’t work when I just change the extension. We use some JSX in some of our register functions, our setup is quite complicated).
2. Is it possible to make DevTools see our external UI components? For now I see that only components that are created directly in the code are seen by DevTools. Our UI components from common UI library are registered by us manually but DevTools don’t see them… So we can’t map them to our Figma components ☹ 90% of our components are in UI libraries…

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [April 5, 2024, 5:27pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/4 "2024-04-05T17:27:10Z")

</div>

> [@LucasMatuszewski](#):
>
> ith `npm run dev` I get:
> 
> ```auto
> POST https://cdn.builder.io/api/v2/admin, duration: 552ms
> GET https://cdn.builder.io/api/v3/data?limit=1&cachebust=true&collection=content&query.published.%24ne=archived&query.query.%24elemMatch.%24and%5B0%5D.property=urlPath&query.query.%24elemMatch.%24and%5B0%5D.operator=is&query.query.%24elemMatch.%24and%5B0%5D.value=%2Fbuilder-demo&query.modelId=453dd1daf33845e89904a7c7c523e463&apiKey=50612480d3c642cea40342a99f4dc2b7, duration: 323ms
> ^CcreateTsProgram Error: EISDIR: illegal operation on a directory, read
> at Object.readSync (node:fs:751:3)
> at tryReadSync (node:fs:451:20)
> at readFileSync (node:fs:497:19)
> at Object.readFileSync (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node/index.cjs:1:2346)
> at Object.getSourceFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:22:120)
> at findSourceFileWorker (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122233:25)
> at findSourceFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122152:22)
> at /home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122101:24
> at getSourceFileFromReferenceWorker (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122070:28)
> at processSourceFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:122099:7)
> at processRootFile (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:121897:7)
> at /home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:120631:43
> at forEach (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:55:24)
> at Object.createProgram (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/node_modules/typescript/lib/typescript.js:120631:7)
> at eo (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:22:1496)
> at U (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:22:552)
> at async Xe (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:32:8332)
> at async M (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:32:8390)
> at async Do (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:230:203)
> at async dn (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/core/index.cjs:32:10267)
> at async V (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/server/index.cjs:7:3226)
> at async j (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/server/index.cjs:7:4574)
> at async X (/home/lucas/DEV/lewiscellars-nextjs/node_modules/@builder.io/dev-tools/server/index.cjs:199:985) {
> errno: -21,
> syscall: 'read',
> code: 'EISDIR'
> }
> 
> ```

You may find help at

> [@withBuilderDevTools does not work in next.js turbo monorepo](https://forum.builder.io/t/withbuilderdevtools-does-not-work-in-next-js-turbo-monorepo/5314):
>
> I installed builder in our next.js 14 / app dir / turbo monorepo app. It seems that whatever builder is doing it can’t handle the local workspace package references: /Users/martinwawrusch/Dev/roji/monorepo/roji-monorepo/packages/roji-domain-site-header/package.json The roji-domain-site-header is the name of the package, which is local to our monorepo. Please advise on how to fix this. This is the error I get: POST https://cdn.builder.io/api/v2/admin, duration: 325ms GET https://cdn.builder…

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [April 5, 2024, 5:30pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/5 "2024-04-05T17:30:40Z")

</div>

> [@LucasMatuszewski](#):
>
> BTW, other questions we have:
> 
> 1. is it possible to use `builder-registry.tsx` (instead of `ts`)? Now it doesn’t work when I just change the extension. We use some JSX in some of our register functions, our setup is quite complicated).
> 2. Is it possible to make DevTools see our external UI components? For now I see that only components that are created directly in the code are seen by DevTools. Our UI components from common UI library are registered by us manually but DevTools don’t see them… So we can’t map them to our Figma components ☹ 90% of our components are in UI libraries…

1. Ideally it should work, though you may need to import builder-registry.tsx file in the component → builder.tsx file for app router or \_app.tsx for pages router.

2. You can try importing external component in the builder-registry.tsx file and see if that works.

---

<div class="post-metadata">

**Author:** ![LucasMatuszewski](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/lucasmatuszewski/32/2130_2.png) [@LucasMatuszewski](https://forum.builder.io/u/LucasMatuszewski)\
**Post date:** [April 7, 2024, 9:47pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/6 "2024-04-07T21:47:54Z")

</div>

Hey, thanks for response.

I’m afraid it’s not the same case. We get this error from the same function (`createTsProgram`) but the error is totally different (`illegal operation on a directory, read` **vs** `Invalid path`). We don’t have a Monorepo with local packages, and we get the same error for every file in our project (not only for a specific file).

Please, can you analyze what can cause this error in your code?  
Where `e.ts.createProgram(n)` function comes from? Is it TS function? What is it’s original name? I try to find what directory it may try to read, but without success so far.

Is it possible to see somewhere the source code of your DevTools? (I don’t see in on your Github and it’s hard to debug it with minified version)

---

<div class="post-metadata">

**Author:** ![LucasMatuszewski](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/lucasmatuszewski/32/2130_2.png) [@LucasMatuszewski](https://forum.builder.io/u/LucasMatuszewski)\
**Post date:** [April 7, 2024, 10:03pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/7 "2024-04-07T22:03:47Z")

</div>

> 1. Ideally it should work, though you may need to import builder-registry.tsx file in the component → builder.tsx file for app router or \_app.tsx for pages router.
> 2. You can try importing external component in the builder-registry.tsx file and see if that works.

Thanks, we tried both, and it doesn’t work.

1. we can use whatever name we want instead of `builder-registry.ts` (initially we had `/components/builder/index.tsx`) and it will work for [Builder.io](http://Builder.io) when we will import this file in our `_app.tsx` file = we have access to these components in Builder UI. But it doesn’t work for DevTools - it seems you expect the exact file name and location (but without access to DevTool’s source code I can’t validate it).  
It would be great to have a config option as an argument to your devtools initialization function to provide any path and name for “registry” file we want (we would just point to our current `/components/builder/index.tsx` without refactoring our code).

2. I’ve moved all our imports of external components from `/components/builder/index/tsx` file to `builder-registry.ts` file, they are registered in [Builder.io](http://Builder.io) UI, but DevTools just don’t see them (in right sidebar \> Components tab). It looks like it expects the files with components definition / export in project’s directory. Any other suggestions please?

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [April 15, 2024, 8:53am UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/8 "2024-04-15T08:53:12Z")

</div>

Hello @LucasMatuszewski,

At present, modifying the builder-registry.ts file isn’t possible. However, if you believe this functionality should be allowed, we recommend submitting a feature request at [our Ideas Portal](https://ideas.builder.io/ideas/).

---

<div class="post-metadata">

**Author:** ![Soumyaranjan](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Soumyaranjan](https://forum.builder.io/u/Soumyaranjan)\
**Post date:** [May 17, 2024, 12:51pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/9 "2024-05-17T12:51:50Z")

</div>

I am also getting same issue

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/e/ec96eb4cce5cfd913f3ab3b99a5f09cb2f9ea33a.jpeg)

is this issue solved??  
when i am trying to register it is giving this error…

when i am trying to mannually ,it is not showing in builder io

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/4/41ddff62dff1d5da62492b9da8fdbf3b1be13d74.jpeg)

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [May 17, 2024, 1:44pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/10 "2024-05-17T13:44:57Z")

</div>

Hello @Soumyaranjan,

Could you confirm which version of @builder.io/dev-tools are you using currently?

---

<div class="post-metadata">

**Author:** ![Soumyaranjan](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Soumyaranjan](https://forum.builder.io/u/Soumyaranjan)\
**Post date:** [May 17, 2024, 2:00pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/11 "2024-05-17T14:00:12Z")

</div>

Hi @manish-sharma i am using following builder io version

“@builder.io/dev-tools”: “^1.0.12”,  
“@builder.io/react”: “^3.2.6”,  
“@builder.io/sdk”: “^2.2.2”,  
“@builder.io/sdk-react-nextjs”: “^0.14.21”

I am running this command (npm init [builder.io](http://builder.io)@latest) to install builder io in  
next js 14… builder.tsx file also not creating automatically i have added it mannually and also in builder-registry file is crfeating empty…

```
  **Is it supprot next js 14 server side rendering?** when i am doing with client side it is working fine but in server side i am facing more problem..

```

my page.tsx look like this

````auto
import {
  Content,
  fetchOneEntry,
  getBuilderSearchParams,
} from "@builder.io/sdk-react-nextjs";
import Carousel from "@/components/Carousel";
import ProductSlider from "@/components/ProductsSlider";
import ProductCard from "@/components/Product/product-card";

interface MyPageProps {
  params: {
    page: string[];
  };
  searchParams: Record<string, string>;
}

const apiKey = "";

export default async function Page(props: MyPageProps) {
  // const customComponents = await loadComponents();

  const urlPath = "/" + (props.params?.page?.join("/") || "");

  const content = await fetchOneEntry({
    model: "page",
    apiKey,
    options: getBuilderSearchParams(props.searchParams),
    userAttributes: { urlPath },
  });

  return (
    <>
      <Content
        content={content}
        model="page"
        apiKey={apiKey}
      />
      <Carousel/>
      <ProductSlider/>
      <ProductCard/>
    </>
  );
}
export const revalidate = 1;```

producard component is serverside....
````

---

<div class="post-metadata">

**Author:** ![Soumyaranjan](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Soumyaranjan](https://forum.builder.io/u/Soumyaranjan)\
**Post date:** [May 17, 2024, 3:59pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/12 "2024-05-17T15:59:08Z")

</div>

This is my builder.tsx file

```auto
"use client";
import { ComponentProps } from "react";
// import { BuilderComponent, useIsPreviewing } from "@builder.io/react";
import { BuilderComponent, useIsPreviewing } from "@builder.io/react";

import { BuilderContent, builder } from "@builder.io/sdk";
import DefaultErrorPage from "next/error";
import "../builder-registry";

type BuilderPageProps = ComponentProps<typeof BuilderComponent>;

// Builder Public API Key set in .env file
builder.init(process.env.NEXT_PUBLIC_BUILDER_API_KEY!);

export function RenderBuilderContent({ content, model }: BuilderPageProps) {
  // Call the useIsPreviewing hook to determine if
  // the page is being previewed in Builder
  const isPreviewing = useIsPreviewing();
  // If "content" has a value or the page is being previewed in Builder,
  // render the BuilderComponent with the specified content and model props.
  if (content || isPreviewing) {
    return <BuilderComponent content={content} model={model} />;
  }
  // If the "content" is falsy and the page is
  // not being previewed in Builder, render the
  // DefaultErrorPage with a 404.
  return <DefaultErrorPage statusCode={404} />;
}

```

This is builder-registry.ts file

```auto
"use client";
import { builder, Builder } from "@builder.io/react";
import Carousel from "./components/Carousel";
import Counter from "./components/Counter/Counter";
import KiboHeroCarousel from "./components/Carousel/KiboHeroCarousel";
import ProductSlider from "./components/ProductsSlider";

builder.init(process.env.NEXT_PUBLIC_BUILDER_API_KEY!);

Builder.registerComponent(Counter, {
  name: "Counter",
  inputs: [
    {
      name: "initialCount",
      type: "number",
    },
  ],
});

```

---

<div class="post-metadata">

**Author:** ![Soumyaranjan](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Soumyaranjan](https://forum.builder.io/u/Soumyaranjan)\
**Post date:** [May 17, 2024, 4:01pm UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/13 "2024-05-17T16:01:30Z")

</div>

Hi @manish-sharma  
can you please confirm me??

Please confirm me i have some doubts in main page.tsx file i am using  
this sdk import {  
Content,  
fetchOneEntry,  
getBuilderSearchParams,  
} from “@builder.io/sdk-react-nextjs”;

but in builder.tsx and builder-registry i am using

import { BuilderComponent, useIsPreviewing } from “@builder.io/react”;  
import { BuilderContent, builder } from “@builder.io/sdk”;

in builder-registry also same  
import { builder, Builder } from “@builder.io/react”;  
can you please confirm i am getting this error for this ???if for this i am getting error then what i will use ?

when i am using (import {builder} from “@builder.io/sdk-react-nextjs”)  
in builder.tsx file i am getting error so i am using this

import { BuilderContent, builder } from “@builder.io/sdk”;

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [May 19, 2024, 1:40am UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/14 "2024-05-19T01:40:03Z")

</div>

Hello @Soumyaranjan,

I suspect the issue is due to the use of `@builder.io/sdk-react-nextjs` and the server-side component. However, I’m not entirely sure, so I’m trying to reproduce the issue on our end before we can confirm anything.

---

<div class="post-metadata">

**Author:** ![Soumyaranjan](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Soumyaranjan](https://forum.builder.io/u/Soumyaranjan)\
**Post date:** [May 19, 2024, 5:40am UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/15 "2024-05-19T05:40:40Z")

</div>

Thank you @manish-sharma

i am looking forward to your reply.

---

<div class="post-metadata">

**Author:** ![Soumyaranjan](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Soumyaranjan](https://forum.builder.io/u/Soumyaranjan)\
**Post date:** [May 21, 2024, 4:03am UTC](https://forum.builder.io/t/dev-tools-createtsprogram-error-eisdir-illegal-operation-on-a-directory-read/5290/16 "2024-05-21T04:03:38Z")

</div>

Hi @manish-sharma

Any update about this error.
