nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.83k stars 1.5k forks source link

[BUG] - 'Component' cannot be used as a JSX component. #3949

Open cherry-min opened 2 hours ago

cherry-min commented 2 hours ago

NextUI Version

2.4.8

Describe the bug

jusy run yarn add -g nextui-cli and nextui init my-nextui-app then open this dir with VScode ,run yarn install in Terminal , next setp to run yarn build. this error is print in my Terminal . image

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Issue Title: Build Error After Running NextUI Setup

Description:

I ran the following commands to set up my NextUI project:

  1. yarn global add nextui-cli
  2. nextui init my-nextui-app
  3. Opened the directory with VSCode.
  4. Ran yarn install in the terminal.
  5. Attempted to run yarn build, but encountered an error.

Steps to Reproduce:

  1. Run yarn global add nextui-cli
  2. Run nextui init my-nextui-app
  3. Open the project directory in VSCode.
  4. Run yarn install
  5. Run yarn build

Error Message:


./components/theme-switch.tsx:42:6
Type error: 'Component' cannot be used as a JSX component.
  Its element type 'Element | Component<any, any, any> | null' is not a valid JSX element.
    Type 'Component<any, any, any>' is not assignable to type 'Element | ElementClass | null'.
      Type 'Component<any, any, any>' is not assignable to type 'ElementClass'.
        The types returned by 'render()' are incompatible between these types.
          Type 'React.ReactNode' is not assignable to type 'import("C:/Users/maqingbo/Desktop/my-nextui-app/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index").ReactNode'.
            Type 'bigint' is not assignable to type 'ReactNode'.

  40 |
  41 |   return (
> 42 |     <Component
     |      ^
  43 |       {...getBaseProps({
  44 |         className: clsx(
  45 |           "px-px transition-opacity hover:opacity-80 cursor-pointer",
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment:

Expected behavior

not error

Screenshots or Videos

No response

Operating System Version

Windows

Browser

Chrome

linear[bot] commented 2 hours ago

ENG-1497 [BUG] - 'Component' cannot be used as a JSX component.