Search code examples
reactjsnext.jspackageshadcnui

How to install shadcn component library using yarn or npm?


Currently, I'm trying to build a Notion clone using Next.js and shadcn/ui [https://ui.shadcn.com/].

I tried to install shadcn/ui using both npm and yarn but it didn't work.


Solution

  • on my side, the npx install shadcn-ui@latest gave me a NodeJS module error so I ended up asking ChatGPT how to install it with npm instead

    so try this;

    npm install -g shadcn-ui
    shadcn-ui init
    

    if you're using Linux distro(do the same for components as well).

    sudo npx shadcn-ui@latest init
    

    or

    sudo npm install -g shadcn-ui
    shadcn-ui init
    

    Note Paste both commands(the install and init) on the terminal simultaneously.