oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.76k stars 2.55k forks source link

shadcn-ui #4865

Open patbhakta opened 9 months ago

patbhakta commented 9 months ago

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

  at readFileSync (/tmp/shadcn-ui@latest--bunx/node_modules/jsonfile/index.js:50:18)
  at /tmp/shadcn-ui@latest--bunx/node_modules/shadcn-ui/dist/index.js:1145:28
  at main (/tmp/shadcn-ui@latest--bunx/node_modules/shadcn-ui/dist/index.js:1144:19)
  at /tmp/shadcn-ui@latest--bunx/node_modules/shadcn-ui/dist/index.js:1154:0
  at processTicksAndRejections (:1:2602)

error: "shadcn-ui" exited with code 1 (SIGHUP)

Additional information

No response

patbhakta commented 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)

patbhakta commented 9 months ago

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.

patbhakta commented 9 months ago

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]

matallui commented 9 months ago

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.

shambhav15 commented 6 months ago

➜ 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

Neel2904 commented 2 months ago

` 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.
omanramalho42 commented 3 weeks ago

try using bun i shadcn-ui@latest init