Open patbhakta opened 9 months ago
bunx shadcn-ui@latest init
file:///tmp/shadcn-ui@latest--bunx/node_modules/shadcn-ui/dist/index.js:67
Failed to load tsconfig.json. ${tsConfig.message ?? ""}
.trim()
^
SyntaxError: Unexpected token '?' at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18) at async link (internal/modules/esm/module_job.js:42:21) error: "shadcn-ui" exited with code 1 (SIGHUP)
npx shadcn-ui@latest init √ Would you like to use TypeScript (recommended)? ... no / yes √ Which style would you like to use? » Default √ Which color would you like to use as base color? » Neutral √ Where is your global CSS file? ... app/globals.css √ Would you like to use CSS variables for colors? ... no / yes √ Where is your tailwind.config.js located? ... tailwind.config.js √ Configure the import alias for components: ... @/components √ Configure the import alias for utils: ... @/lib/utils √ Are you using React Server Components? ... no / yes √ Write configuration to components.json. Proceed? ... yes
✔ Writing components.json... ✔ Initializing project... ⠋ Installing dependencies...Command failed with exit code 1: bun add tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react 'bun' is not recognized as an internal or external command, operable program or batch file.
bun add tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react bun add v1.0.0 (822a00c4)
installed tailwindcss-animate@1.0.7 installed class-variance-authority@0.7.0 installed clsx@2.0.0 installed tailwind-merge@1.14.0 installed lucide-react@0.276.0
5 packages installed [36.70s]
This seems to work fine with Bun v1.0.2. I just followed the same commands and it worked.
I'm having issues but only in a monorepo setup, which I believe are bun related, not shadcn-ui.
➜ bun_auth bunx --bun shadcn-ui@latest init
45 | const fs = options.fs || _fs; 46 | 47 | const shouldThrow = 'throws' in options ? options.throws : true; 48 | 49 | try { 50 | let content = fs.readFileSync(file, options); ^ ENOENT: package.json: No such file or directory errno: -2 syscall: "open" path: "package.json"
same issue with bun
` const fs = options.fs || _fs 46 | 47 | const shouldThrow = 'throws' in options ? options.throws : true 48 | 49 | try { 50 | let content = fs.readFileSync(file, options) ^ ENOENT: package.json: No such file or directory errno: -2 syscall: "open" path: "package.json"
at readFileSync (/private/tmp/bunx-501-shadcn-ui@latest/node_modules/jsonfile/index.js:50:19)
at /private/tmp/bunx-501-shadcn-ui@latest/node_modules/shadcn-ui/dist/index.js:245:5379
at _t (/private/tmp/bunx-501-shadcn-ui@latest/node_modules/shadcn-ui/dist/index.js:245:5364)
at /private/tmp/bunx-501-shadcn-ui@latest/node_modules/shadcn-ui/dist/index.js:245:5606`
I am also facing same issue on shadcn installation with bun.
try using bun i shadcn-ui@latest init
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
bunx create-next-app test --ts --tailwind --eslint --app --src-dir --use-bun --import-alias "@/*" bunx shadcn-ui@latest init
What is the expected behavior?
Would you like to use TypeScript (recommended)? no / yes Which style would you like to use? › Default Which color would you like to use as base color? › Slate Where is your global CSS file? › › app/globals.css Do you want to use CSS variables for colors? › no / yes Where is your tailwind.config.js located? › tailwind.config.js Configure the import alias for components: › @/components Configure the import alias for utils: › @/lib/utils Are you using React Server Components? › no / yes
What do you see instead?
45 | const fs = options.fs || _fs 46 | 47 | const shouldThrow = 'throws' in options ? options.throws : true 48 | 49 | try { 50 | let content = fs.readFileSync(file, options) ^ ENOENT: package.json: No such file or directory path: "package.json" syscall: "open" errno: -2
error: "shadcn-ui" exited with code 1 (SIGHUP)
Additional information
No response