Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add new sidebar component ENOTDIR: not a directory #351

Open
dan-cooke opened this issue Dec 21, 2024 · 1 comment
Open

Cannot add new sidebar component ENOTDIR: not a directory #351

dan-cooke opened this issue Dec 21, 2024 · 1 comment

Comments

@dan-cooke
Copy link

dan-cooke commented Dec 21, 2024

The plugin seems to be looking in the wrong location.

nx run shadcn:add sidebar --verbose


 NX   Command failed: npx shadcn@latest add sidebar

Error: Command failed: npx shadcn@latest add sidebar
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at /home/dan/dev/templi/ui/node_modules/@nx-extend/shadcn-ui/src/executors/add/add.impl.js:11:38
    at Generator.next (<anonymous>)
    at /home/dan/dev/templi/ui/node_modules/@nx-extend/shadcn-ui/node_modules/tslib/tslib.js:169:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/home/dan/dev/templi/ui/node_modules/@nx-extend/shadcn-ui/node_modules/tslib/tslib.js:165:16)
    at addExecutor (/home/dan/dev/templi/ui/node_modules/@nx-extend/shadcn-ui/src/executors/add/add.impl.js:9:20)
    at runExecutorInternal (/home/dan/dev/templi/ui/node_modules/nx/src/command-line/run/run.js:98:19)


The path it is trying to create a dir is

ENOTDIR: not a directory, mkdir '/home/dan/dev/templi/ui/libs/shadcn/src/index.ts/ui'

Where my shadcn lib is at libs/shadcn an the utils lib/shadcn-utils


``

Node           : 20.9.0
OS             : linux-x64
Native Target  : x86_64-linux
yarn           : 1.22.22

nx (global)            : 20.3.0
nx                     : 20.3.0
@nx/js                 : 20.3.0
@nx/jest               : 20.3.0
@nx/eslint             : 20.3.0
@nx/workspace          : 20.3.0
@nx/cypress            : 20.3.0
@nx/devkit             : 20.3.0
@nx/esbuild            : 20.3.0
@nx/eslint-plugin      : 20.3.0
@nx/module-federation  : 20.3.0
@nx/nest               : 20.3.0
@nx/node               : 20.3.0
@nx/react              : 20.3.0
@nx/vite               : 20.3.0
@nx/web                : 20.3.0
@nx/webpack            : 20.3.0
typescript             : 5.6.3
---------------------------------------
Registered Plugins:
@nx/vite/plugin
@nx/eslint/plugin
@nx/webpack/plugin
@nx/jest/plugin
@nxtensions/astro
---------------------------------------
Community plugins:
@nx-extend/shadcn-ui : 4.2.1
@nxtensions/astro    : 19.0.1
@webpro/nx-tsc       : 0.0.1


## My shadcn project.json

```.json
{
  "name": "shadcn",
  "$schema": "../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "libs/shadcn/src",
  "projectType": "library",
  "tags": [],
  "targets": {
    "add": {
      "executor": "@nx-extend/shadcn-ui:add"
    },
    "lint": {
      "executor": "nx:run-commands",
      "options": {
        "command": "echo"
      }
    }
  }
}

My shadcn-utils project.json

{
  "name": "shadcn-utils",
  "$schema": "../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "libs/shadcn-utils/src",
  "projectType": "library",
  "tags": [],
  "targets": {}
}

nx.json

{
  "$schema": "./node_modules/nx/schemas/nx-schema.json",
  "namedInputs": {
    "default": [
      "{projectRoot}/**/*",
      "sharedGlobals"
    ],
    "production": [
      "default",
      "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
      "!{projectRoot}/tsconfig.spec.json",
      "!{projectRoot}/eslint.config.js",
      "!{projectRoot}/cypress/**/*",
      "!{projectRoot}/**/*.cy.[jt]s?(x)",
      "!{projectRoot}/cypress.config.[jt]s",
      "!{projectRoot}/jest.config.[jt]s",
      "!{projectRoot}/src/test-setup.[jt]s",
      "!{projectRoot}/test-setup.[jt]s"
    ],
    "sharedGlobals": []
  },
  "plugins": [
    {
      "plugin": "@nx/vite/plugin",
      "options": {
        "buildTargetName": "build",
        "skipTypeCheck": false,
        "previewTargetName": "preview",
        "testTargetName": "test",
        "serveTargetName": "serve",
        "serveStaticTargetName": "serve-static"
      }
    },
    {
      "plugin": "@nx/eslint/plugin",
      "options": {
        "targetName": "lint"
      }
    },
    {
      "plugin": "@nx/webpack/plugin",
      "options": {
        "buildTargetName": "build",
        "serveTargetName": "serve",
        "previewTargetName": "preview"
      }
    },
    {
      "plugin": "@nx/jest/plugin",
      "options": {
        "targetName": "test"
      }
    },
    "@nxtensions/astro"
  ],
  "targetDefaults": {
    "deploy": {
      "cache": true,
      "externalDependencies": []
    },
    "type-check": {
      "builder": "@nrwl/workspace:run-commands",
      "options": {
        "command": "npm run tsc -- -b ./apps/content/tsconfig.json --incremental"
      }
    },
    "@nx/esbuild:esbuild": {
      "cache": false,
      "dependsOn": [
        "^build"
      ],
      "inputs": [
        "production",
        "^production"
      ]
    },
    "@nx/js:node": {
      "cache": false,
      "dependsOn": [
        "^dist"
      ],
      "inputs": [
        "production",
        "^production"
      ]
    },
    "@nxtensions/astro:build": {
      "inputs": [
        "production",
        "^production"
      ],
      "outputs": [
        "{workspaceRoot}/dist/{projectRoot}"
      ],
      "cache": true
    },
    "@nxtensions/astro:check": {
      "inputs": [
        "production",
        "^production"
      ],
      "cache": true
    },
    "@nxtensions/astro:preview": {
      "dependsOn": [
        "build"
      ]
    }
  },
  "generators": {
    "@nx/react": {
      "library": {
        "style": "css",
        "linter": "eslint",
        "unitTestRunner": "vitest"
      },
      "application": {
        "babel": true,
        "style": "css",
        "linter": "eslint",
        "bundler": "vite"
      },
      "component": {
        "style": "css"
      }
    }
  },
  "defaultProject": "marketing",
  "useLegacyCache": true
}

components.json

{
  "$schema": "https://ui.shadcn.com/schema.json",
  "style": "default",
  "rsc": false,
  "tailwind": {
    "config": "libs/shadcn-utils/src/tailwind.config.ts",
    "css": "libs/shadcn-utils/src/global.css",
    "baseColor": "slate",
    "cssVariables": false
  },
  "aliases": {
    "components": "@templi/shadcn",
    "utils": "@templi/shadcn-utils"
  }
}

@TriPSs
Copy link
Owner

TriPSs commented Dec 24, 2024

Think you added shadcn to your repo before they migrated to the new cli?

Can you update your components.json to have these:

  "aliases": {
    "ui": "@templi/shadcn",
    "components": "@templi/shadcn/components",
    "hooks": "@templi/shadcn/hooks",
    "utils": "@templi/utils"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants