#Cannot find module '@nextui-org/button'

6 messages · Page 1 of 1 (latest)

ornate sail
#

Hi, i want to start my project with next-ui v2.
I tried to complete the installation process and use the components, but there was a problem.

Cannot find module '@nextui-org/button' or its corresponding type declarations. ts(2307)

import { Button } from '@nextui-org/button';

export default function Page() {
  return (
    <div>
      <Button>Click me</Button>
    </div>
  );
}

heres the code.

I used next.js 13.
When running pnpm dev it runs without any problems, but it keeps appearing as a problem on vscode.

please help me...

In addition, please understand if this article is difficult to read because it is written in a translator.

graceful pine
#

Did you install it? npm i @silver scroll-org/button

ornate sail
# graceful pine Did you install it? npm i <@1017382842734489670>-org/button

I read and followed the official document.
https://nextui.org/docs/frameworks/nextjs

When using next-ui v2 as the app directory in next13 version, it was supposed to install only @silver scroll-org/react and framer-motion, so I installed both as pnpm.

In app directory setup #5

Important 🚨: Note that you need to import the component from the individual package, not the from @nextui-org/react.

I followed it because it said so.

Should I install individual packages even if I installed @silver scroll-org/react?

graceful pine
#

Yes to make typescript happy

#

@silver scroll-org/react has all the components under the hood in its package.json, so the import should work, but typescript will find the types in the exact path, so any component you want to use on Next.js App directory needs to be installed