Linting and checking validity of types .Failed to compile.
./components/flickity-hero.tsx:23:14
Type error: 'Flickity' cannot be used as a JSX component.
Its instance type 'Flickity' is not a valid JSX element.
Type error: 'Flickity' cannot be used as a JSX component.
Its instance type 'Flickity' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'React.ReactNode' is not assignable to type 'import("/home/coke/_prj/node_modules/@types/react/ts5.0/index").ReactNode'.
Type 'PromiseLikeOfReactNode' is not assignable to type 'ReactNode'.
Usingn Nextjs cannot build production:
▲ Next.js 14.0.4
package.json:
{ "private": true, "scripts": { "dev": "next", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.5.1", "@fortawesome/free-brands-svg-icons": "^6.5.1", "@fortawesome/free-regular-svg-icons": "^6.5.1", "@fortawesome/free-solid-svg-icons": "^6.5.1", "@fortawesome/react-fontawesome": "^0.2.0", "@next/third-parties": "^14.0.4", "@types/node": "^18.6.3", "@types/nodemailer": "^6.4.14", "@types/react": "^18.0.15", "@types/react-dom": "^18.0.6", "bootstrap": "^5.3.2", "classnames": "^2.3.1", "date-fns": "^2.28.0", "flickity": "^2.3.0", "framer-motion": "^10.18.0", "mmenu-js": "^9.3.0", "next": "latest", "nodemailer": "^6.9.7", "react": "^18.2.0", "react-bootstrap": "^2.9.1", "react-dom": "^18.2.0", "react-flickity-component": "^4.0.7", "react-hook-form": "^7.49.0", "react-lite-youtube-embed": "^2.4.0", "react-select-country-list": "^2.2.3", "sass": "^1.69.7", "typescript": "^4.7.4" }, "devDependencies": { "autoprefixer": "10.4.7", "postcss": "8.4.31" }, "resolutions": { "@types/react": "17.0.30" } }
component:
`
npm run build:
` npm run build
Linting and checking validity of types .Failed to compile.
./components/flickity-hero.tsx:23:14 Type error: 'Flickity' cannot be used as a JSX component. Its instance type 'Flickity' is not a valid JSX element.
21 | 22 |
Tried with the simple example provided here and same result.
thanks in advance.
can you confirm it's not because of multiple version of @types/react? https://stackoverflow.com/questions/71877218/provider-cannot-be-used-as-a-jsx-component/71877791#71877791
@yaodingyd i got more info
Type error: 'Flickity' cannot be used as a JSX component. Its instance type 'Flickity' is not a valid JSX element. The types returned by 'render()' are incompatible between these types. Type 'React.ReactNode' is not assignable to type 'import("/home/coke/_prj/node_modules/@types/react/ts5.0/index").ReactNode'. Type 'PromiseLikeOfReactNode' is not assignable to type 'ReactNode'.
nvm, after that paste, i noticied that dont know why, it was looking for the node_modules in the wrong directory, not on the project directory!
This can be closed, i was able to run the production build! Thanks for your time tho!