Closed niassuh1 closed 1 week ago
I think this might be the same issue, received with pnpm.
tysonlawrie$ pnpm dlx shadcn-ui@latest add slider
ENOENT Command failed with ENOENT: shadcn-ui add slider
spawn shadcn-ui ENOENT
pnpm: Command failed with ENOENT: shadcn-ui add slider
spawn shadcn-ui ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
with npx it worked
npx shadcn@latest add slider
Need to install the following packages:
shadcn@2.0.1
Ok to proceed? (y) y
✔ Checking registry.
✔ Installing dependencies.
✔ Created 1 file:
- app/components/ui/slider.tsx
Oddly enough... When I answered the questions differently as follows:
√ Which style would you like to use? » New York
√ Which color would you like to use as the base color? » Neutral
√ Would you like to use CSS variables for theming? ... yes
✔ Writing components.json.
✔ Checking registry.
✔ Updating tailwind.config.ts
✔ Updating app\globals.css
✔ Installing dependencies.
✔ Created 1 file:
- lib\utils.ts
Success! Project initialization completed.
You may now add components.
It works just fine
Also I'm running the command with npx
but have a yarn.lock
file in my project
@niassuh1 I'm gonna see if I can reproduce this.
@tlawrie Please note that the new cli is shadcn
and not shadcn-ui
(which we'll deprecate later)
This command reproduces the issue:
yarn add tailwindcss-animate class-variance-authority lucide-react "" clsx tailwind-merge
Empty strings need to be removed from the command parameters.
Verified. This is the out put I get:
[
'tailwindcss-animate',
'class-variance-authority',
'lucide-react',
'',
'clsx',
'tailwind-merge'
]
after adding this console.log to the command.
function He(e,t,r){if(e=Array.from(new Set(e)),!e?.length)return;console.log(e);r={silent:!1,...r};let i=w("Installing dependencies.",{silent:r.silent})?.start(),n=await J(t.resolvedPaths.cwd);await nr(n,[n==="npm"?"install":"add",...e],{cwd:t.resolvedPaths.cwd}),i?.succeed()}
Looks like it's coming from a fetch call, so I intercepted those and found this:
{
name: 'default',
type: 'registry:style',
dependencies: [
'tailwindcss-animate',
'class-variance-authority',
'lucide-react',
''
],
registryDependencies: [ 'utils' ],
tailwind: { config: { plugins: [Array] } },
cssVars: {},
files: []
}
Which is coming from this file, which contains the empty string:
https://ui.shadcn.com/r/styles/default/index.json
which comes from this file: apps/www/public/r/styles/default/index.json
Fixed by this PR: https://github.com/shadcn-ui/ui/pull/4724
Workaround: Select "new-york" and switch style
to "default"
in components.json.
Windows 11, node v20.17.0. Git Bash
$ npx shadcn@latest init npm error code ENOENT npm error syscall lstat npm error path C:\Users\baken\AppData\Roaming\npm npm error errno -4058 npm error enoent ENOENT: no such file or directory, lstat 'C:\Users\baken\AppData\Roaming\npm' npm error enoent This is related to npm not being able to find a file. npm error enoent npm error A complete log of this run can be found in: C:\Users\baken\AppData\Local\npm-cache_logs\2024-09-03T16_13_16_318Z-debug-0.log
2024-09-03T16_13_16_318Z-debug-0.log log file
EDITED:
Sorry, i just forgot to add tailwind directives in main css file. If anyone has the same problem, check your css file, is it there?
@tailwind base;
@tailwind components;
@tailwind utilities;
Thank you all for your efforts!
Describe the bug
When running
npx shadcn@latest init
, and after answering all the questions, it goes through installing all the dependencies, and throws an error before finishing like so:However, when I try running
yarn add tailwindcss-animate class-variance-authority lucide-react clsx tailwind-merge
by myself, it works just fine.Affected component/components
None
How to reproduce
npx shadcn@latest init
commandinstalling dependencies
step in the cliCodesandbox/StackBlitz link
Not needed
Logs
System Info
Before submitting