Npx shadcnui@latest init button input is not working

When I am typing npx shadcnui@latest init button input in my nexjs app it gives the error:

npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/shadcnui - Not found npm ERR! 404 npm ERR! 404  'shadcnui@latest' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR!     C:\Users\R.A\AppData\Local\npm-cache_logs\2024-09-15T17_18_49_886Z-debug-0.log

I am using vscode and node version 20.17.0 through nvm Next.js v14.2.11.

The error indicates that shadcnui is not available in the npm registry. This could be due to a typo or because the package might not exist under that name. To resolve this issue, follow these steps:

  1. Check the Correct Package Name:
  • Make sure that you are using the correct package name. If you are referring to the shadcn/ui package (commonly used for UI components in Next.js apps), the command would look like this:

bash

npx @shadcn/ui@latest init button
  • Note the @ symbol, which is important for scoped packages (packages with a namespace, like @shadcn).
  1. Clear npm Cache:
  • Sometimes, cache issues can cause npm to fail. Clear the npm cache using the following command:

bash

npm cache clean --force
  1. Check Node and npm Versions:
  • Make sure that you are using compatible versions of Node.js and npm. Since you are using Node 20.17.0, check if the shadcn/ui package supports this Node version.
  • Also, ensure that you have the latest version of npm by running:

bash

npm install -g npm@latest
  1. Install Directly from GitHub (Alternative):
  • If the package is hosted on GitHub and not in the npm registry, you can install it directly from a GitHub repository:

bash

npx github:shadcn/ui init button
  1. Review Documentation:
  • Check the official documentation or GitHub page for shadcn/ui for specific instructions or alternative installation commands.

Try these steps, and if the issue persists, double-check the package name and its availability on npm or other sources.