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

[Bug]: Can't install Drawer, Dialog and Toast in WSL #430

Open
2 tasks
adiramardiani opened this issue Mar 23, 2024 · 21 comments
Open
2 tasks

[Bug]: Can't install Drawer, Dialog and Toast in WSL #430

adiramardiani opened this issue Mar 23, 2024 · 21 comments
Labels
bug Something isn't working

Comments

@adiramardiani
Copy link

Reproduction

npx shadcn-vue@latest add drawer / toast

Describe the bug

I'm ini using laravel framework configuration and set typescript as false
I don't know this will show just on laravel framework or other framework
Here my components.json

{
    "$schema": "https://shadcn-vue.com/schema.json",
    "style": "default",
    "typescript": false,
    "tailwind": {
        "config": "tailwind.config.mjs",
        "css": "resources/css/app.css",
        "baseColor": "slate",
        "cssVariables": true
    },
    "framework": "laravel",
    "aliases": {
        "components": "@/Components",
        "utils": "@/lib/utils"
    }
}

I try command :

  • npx shadcn-vue@latest add drawer
  • npx shadcn-vue@latest add toast

The component output still using typescript template instead of javascript

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 1.78 GB / 7.64 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 21.7.1 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 10.5.0 - /usr/bin/npm
    pnpm: 8.15.5 - /usr/bin/pnpm
    bun: 1.0.6 - /usr/bin/bun
  npmPackages:
    @vueuse/core: ^10.9.0 => 10.9.0 
    radix-vue: ^1.5.3 => 1.5.3 
    vue: ^3.4.21 => 3.4.21

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
@adiramardiani adiramardiani added the bug Something isn't working label Mar 23, 2024
@sadeghbarati sadeghbarati added need-reproduction Issue is lacking reproduction. Will be close if not provided. and removed bug Something isn't working labels Mar 23, 2024
@sadeghbarati
Copy link
Collaborator

sadeghbarati commented Mar 23, 2024

@adiramardiani Can you share repro with Laravel?

I'm using a normal Vite project and it's ok

Toast.vue

<script setup>
import { computed } from "vue";
import { ToastRoot, useForwardPropsEmits } from "radix-vue";
import { toastVariants } from ".";
import { cn } from "@/lib/utils";

const props = defineProps({
  class: { type: null, required: false },
  variant: { type: null, required: false },
  onOpenChange: { type: Function, required: false, skipCheck: true },
  defaultOpen: { type: Boolean, required: false },
  forceMount: { type: Boolean, required: false },
  type: { type: String, required: false },
  open: { type: Boolean, required: false },
  duration: { type: Number, required: false },
  asChild: { type: Boolean, required: false },
  as: { type: null, required: false },
});

const emits = defineEmits([
  "escapeKeyDown",
  "pause",
  "resume",
  "swipeStart",
  "swipeMove",
  "swipeCancel",
  "swipeEnd",
  "update:open",
]);

const delegatedProps = computed(() => {
  const { class: _, ...delegated } = props;

  return delegated;
});

const forwarded = useForwardPropsEmits(delegatedProps, emits);
</script>

<template>
  <ToastRoot
    v-bind="forwarded"
    :class="cn(toastVariants({ variant }), props.class)"
    @update:open="onOpenChange"
  >
    <slot />
  </ToastRoot>
</template>

Drawer should be fixed after this commit cd3d244

Drawer.vue

<script setup>
import { DrawerRoot } from "vaul-vue";
import { useForwardPropsEmits } from "radix-vue";

const props = defineProps({
  activeSnapPoint: { type: [Number, String, null], required: false },
  closeThreshold: { type: Number, required: false },
  shouldScaleBackground: { type: Boolean, required: false, default: true },
  scrollLockTimeout: { type: Number, required: false },
  fixed: { type: Boolean, required: false },
  dismissible: { type: Boolean, required: false },
  modal: { type: Boolean, required: false },
  open: { type: Boolean, required: false },
  defaultOpen: { type: Boolean, required: false },
  nested: { type: Boolean, required: false },
  snapPoints: { type: Array, required: false },
  fadeFromIndex: { type: null, required: false },
});

const emits = defineEmits([
  "drag",
  "release",
  "close",
  "update:open",
  "update:activeSnapPoint",
]);

const forwarded = useForwardPropsEmits(props, emits);
</script>

<template>
  <DrawerRoot v-bind="forwarded">
    <slot />
  </DrawerRoot>
</template>

@sadeghbarati
Copy link
Collaborator

closing for now will reopen after repro 🙏

@adiramardiani
Copy link
Author

Hi @sadeghbarati

Here my github repo https://github.com/adiramardiani/laravel-shadcn-vue

Here my package.json generated by breeze and shadcn ini

{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build && vite build --ssr"
    },
    "devDependencies": {
        "@inertiajs/vue3": "^1.0.15",
        "@tailwindcss/forms": "^0.5.7",
        "@vitejs/plugin-vue": "^5.0.4",
        "@vue/server-renderer": "^3.4.21",
        "autoprefixer": "^10.4.19",
        "axios": "^1.6.8",
        "laravel-vite-plugin": "^1.0.2",
        "postcss": "^8.4.38",
        "tailwindcss": "^3.4.1",
        "vite": "^5.2.4",
        "vue": "^3.4.21"
    },
    "dependencies": {
        "@radix-icons/vue": "^1.0.0",
        "class-variance-authority": "^0.7.0",
        "clsx": "^2.1.0",
        "radix-vue": "^1.5.3",
        "tailwind-merge": "^2.2.2",
        "tailwindcss-animate": "^1.0.7"
    }
}

Btw, the Drawer still not fixed on my test

image

Thanks

@sadeghbarati
Copy link
Collaborator

Let me try with breeze cause I don't install any requirements for Laravel in my local

@sadeghbarati
Copy link
Collaborator

@adiramardiani

image

@adiramardiani
Copy link
Author

Hmm, is bug just show on my environment only ? hahaha
What your node / pnpm version ?
Btw this is my node, pnpm, and npm version, maybe because my node version

image

I try to create vite project, but the result is same
image

I think this not related laravel or vite, but because some node or etc version
So if you have any other task issue, you can igonre this issue :)

Thank's for your help
Big respect

@sadeghbarati
Copy link
Collaborator

sadeghbarati commented Mar 25, 2024

My node version is 20.11.1 and pnpm is 8.15.5, always on LTS and latest version for other tools

Can you try with pnpm, please remove package-lock and node_modules, and install everything fresh

@adiramardiani
Copy link
Author

Sure, I downgrade node and pnpm like your config, remove lock and node_modules, but still the same :)

node v20.11.1
npm 10.2.4
pnpm 8.15.5

image

Btw this is wsl2 on windows, I dont know this is the clue or not
Maybe we can ignore this issue, and can wait n see, hopefully will fixed or can found the cause later

@sadeghbarati sadeghbarati changed the title [Bug]: Drawer and Toast stil using typescript template when add component in "typescript": false config [Bug]: Can't install Drawer and Toast in Laravel Breeze Mar 25, 2024
@sadeghbarati sadeghbarati reopened this Mar 25, 2024
@sadeghbarati
Copy link
Collaborator

sadeghbarati commented Mar 25, 2024

I will test on WSL tomorrow, also I will send the minimal breeze project here in zip format

@sadeghbarati sadeghbarati removed the need-reproduction Issue is lacking reproduction. Will be close if not provided. label Mar 25, 2024
@justinkekeocha
Copy link

I am having this same issue on WSL2

@adiramardiani adiramardiani changed the title [Bug]: Can't install Drawer and Toast in Laravel Breeze [Bug]: Can't install Drawer, Dialog and Toast in WSL Mar 26, 2024
@adiramardiani
Copy link
Author

@justinkekeocha reported the same issue on WSL, so I change to title

Btw @sadeghbarati
I found new issue on wsl using typescript false, I add dialog component and give as HTMLElement on DialogScrollContent file which is is typescript code, maybe for me is easy fix to edit on code, but just info
So I change the title to add Dialog to

image

@sadeghbarati sadeghbarati added the bug Something isn't working label Mar 26, 2024
@sadeghbarati
Copy link
Collaborator

@Dunqing Hi can you check these problems it is related to detypes

  • CLI is not working well in WSL/WSL2 (test with drawer, and toast)

  • ts types inside <template> is preserved in JS projects


Error is in these lines
https://github.com/radix-vue/shadcn-vue/blob/dev/packages/cli/src/commands/add.ts#L194C9-L215C10

@Reached
Copy link

Reached commented Apr 1, 2024

I am seeing the same issue on MacOS (latest version), running Node v20.11.0 and NPM v10.2.4. Basically unable to install any of the components

@justinkekeocha
Copy link

Coincidentally I am using the same NPM version with node v20.11.1

@tw1nk
Copy link

tw1nk commented Apr 4, 2024

Same issue on Mac with bun 1.1.1

@Dunqing Hi can you check these problems it is related to detypes

  • CLI is not working well in WSL/WSL2 (test with drawer, and toast)
  • ts types inside <template> is preserved in JS projects

Error is in these lines https://github.com/radix-vue/shadcn-vue/blob/dev/packages/cli/src/commands/add.ts#L194C9-L215C10

Seems to be an issue with the detype. Maybe detype could be replaced with ts-to-jsdoc which does almost the same thing but keeps the type information in jsdoc comments.

probably not as reading a bit more it's just a personal pet project. But something similar would be awesome...

@cruzmediaorg
Copy link

I am having this same issue when trying to install the drawer on a Laravel/Vite project by npx shadcn-vue@latest add drawer.

Error:
Installing drawer...
ERROR ENOTDIR: not a directory, stat 'project_path/node_modules/vaul-vue/dist/index.d.ts/tsconfig.json'

@Lucklj521
Copy link

I also encountered the same problem. When I use dialog, export { default as DialogScrollContent } from "./DialogScrollContent.vue"; there is an error of 'Unexpected identifier 'as''. It's still a compatibility issue between ts and js

@graphenn
Copy link

graphenn commented May 8, 2024

WSL(linux) and Mac, so maybe this bug is related with something OS level difference between UNIX system and Windows.

@AlejandroAkbal
Copy link

AlejandroAkbal commented May 21, 2024

I am having this same issue when trying to install the drawer on a Laravel/Vite project by npx shadcn-vue@latest add drawer.

Error: Installing drawer... ERROR ENOTDIR: not a directory, stat 'project_path/node_modules/vaul-vue/dist/index.d.ts/tsconfig.json'

Yup, same issue

Typescript disabled on Linux in a Laravel sail app

sail npx shadcn-vue@latest add drawer
⠴ Installing drawer...
[12:23:29 PM]  ERROR  ENOTDIR: not a directory, stat '/var/www/html/node_modules/vaul-vue/dist/index.d.ts/tsconfig.json'

@justinkekeocha
Copy link

I solved this issue by initializing a new nuxt project, installing shadcn-vue and moving files. Seems shadcn-vue is not built to be installed on already existing projects.

@AlejandroAkbal
Copy link

I solved this issue by initializing a new nuxt project, installing shadcn-vue and moving files. Seems shadcn-vue is not built to be installed on already existing projects.

I tried, but Nuxt projects dont work without typescript as seen on #291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants