ui icon indicating copy to clipboard operation
ui copied to clipboard

Error when running install with CLI in Nx

Open drewhoffer opened this issue 2 years ago • 2 comments

When trying to add a new component to an nx project the error Failed to load tsconfig.json. Couldn't find tsconfig.json occurs. Normally for nx projects you will have a tsconfig.base.json and have tsconfig.json files per project. As of now, I just have an empty tsconfig at the root but wondering if could be fixed.

Thanks

drewhoffer avatar Jun 23 '23 01:06 drewhoffer

I have the same issue.

aziz-matmati avatar Jun 23 '23 15:06 aziz-matmati

I had this same issue but here is how I resolved it. First I added a few project command like so in my apps/app directory (which is a nextjs project).

...
        "ui:add": {
            "executor": "./tools/executors/workspace:run-command",
            "options": {
                "command": "pnpx shadcn-ui add",
                "cwd": "./"
            },
        },
        "ui:init": {
            "executor": "./tools/executors/workspace:run-command",
            "options": {
                "command": "pnpx shadcn-ui init",
                "cwd": "./"
            }
        }
...

The custom executor for doing interactive commands in nx I saw from this issue: https://github.com/nrwl/nx/issues/8269

In this directory is a tsconfig.json which should be read by shadcn-ui

cmrfrd avatar Jun 27 '23 19:06 cmrfrd

I created a GitHub repository with shadcn UI configuration from Nx, you can check it on my profile. And I made a YouTube tutorial on how to do it (It's my first video so it's not that good but I decided to give it a try 😅).

YouTube: Setup tutorial GitHub repo: Repository Boilerplate

anteqkois avatar Aug 03 '23 19:08 anteqkois

@anteqkois In your setup, you have one app and components.json points to that app. How would you configure this with multiple apps?

vdiaz1130 avatar Nov 02 '23 14:11 vdiaz1130

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Jun 22 '24 23:06 shadcn