Skip to content

Conversation

@yeasin2002
Copy link

@yeasin2002 yeasin2002 commented Dec 20, 2025

Fixes #9160

Problem

When creating a new project using npx shadcn@latest create, the CLI accepts uppercase letters in the project name but then fails with a generic error message:

Something went wrong creating a new Next.js project. Please try again.

This happens because npm package names cannot contain uppercase letters, but the CLI wasn't validating this before attempting to create the project.

Solution

Added proper npm package name validation using the validate-npm-package-name package. This validates the project name against npm's naming rules and provides clear, actionable error messages when validation fails.

Reference:

Next CLI validation: https://github.com/vercel/next.js/blob/canary/packages/create-next-app/helpers/validate-pkg.ts

NextJS requires this naming convention, although vite-react and tantack-start might not need this validation. So, we have two options:

  1. Validate only if NextJS is selected
  2. Validate for all frameworks

Option 1 does not seem like a proper solution, so I chose option 2, awaiting opinions or reviews from @shadcn or team members.

Changes

  • Added validate-npm-package-name dependency and its types
  • Created packages/shadcn/src/utils/validate-pkg.ts utility for name validation
  • Updated packages/shadcn/src/commands/create.ts to use the new validation in the project name prompt

Before

image

After

image

@vercel
Copy link
Contributor

vercel bot commented Dec 20, 2025

@yeasin2002 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@yeasin2002 yeasin2002 marked this pull request as draft December 20, 2025 11:56
@yeasin2002 yeasin2002 marked this pull request as ready for review December 20, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Project creation fails when project name contains uppercase letters

1 participant