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]: Error when running npx shadcn-ui@latest init and npx shadcn-ui@latest add button with Node.js v20.13.1 #3774

Open
2 tasks done
TanzimHossain2 opened this issue May 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@TanzimHossain2
Copy link

Describe the bug

I encountered errors when trying to run the shadcn-ui commands as described in the documentation. The commands npx shadcn-ui@latest init and npx shadcn-ui@latest add button fail with a Cannot find package error.

image

Affected component/components

shadcn/ui initialization and component addition commands.

How to reproduce

  1. Create a new Next.js project using the following command:
    npx create-next-app@latest my-app --typescript --tailwind --eslint
  2. Navigate to the project directory:
    cd my-app
  3. Run the shadcn-ui init command:
    npx shadcn-ui@latest init
  4. Alternatively, try adding a component:
    npx shadcn-ui@latest add button

Codesandbox/StackBlitz link

No response

Logs

Error message encountered:

PS C:\Users\Forhad vi\Desktop\Tanzim\LWS\Test1\my-app> npx shadcn-ui@latest init
node:internal/modules/run_main:129
    triggerUncaughtException(
    ^

Error: Cannot find package 'C:\Users\Forhad vi\AppData\Local\npm-cache\_npx\125ee17d583c4e03\node_modules\npm-run-path\node_modules\path-key\package.json' imported from C:\Users\Forhad vi\AppData\Local\npm-cache\_npx\125ee17d583c4e03\node_modules\npm-run-path\index.js
Did you mean to import "path-key/index.js"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:841:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v20.13.1

System Info

- Node.js: v20.13.1 (LTS version)
- Next.js: 14.2.3
- OS: Windows 11

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@TanzimHossain2 TanzimHossain2 added the bug Something isn't working label May 19, 2024
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

1 participant