Next.js, how to fix the error `Constructor requires ‘new’ operator`

I got this error while working with Next.js:

TypeError: Constructor requires 'new' operator

Turns out I used the <Image /> component provided by next/image but I forgot to import it on top:

import Image from 'next/image'

It can be tricky especially if you are moving some JSX around components.


This content originally appeared on flaviocopes.com and was authored by flaviocopes.com

I got this error while working with Next.js:

TypeError: Constructor requires 'new' operator

Turns out I used the <Image /> component provided by next/image but I forgot to import it on top:

import Image from 'next/image'

It can be tricky especially if you are moving some JSX around components.


This content originally appeared on flaviocopes.com and was authored by flaviocopes.com


Print Share Comment Cite Upload Translate Updates
APA

flaviocopes.com | Sciencx (2021-07-09T05:00:00+00:00) Next.js, how to fix the error `Constructor requires ‘new’ operator`. Retrieved from https://www.scien.cx/2021/07/09/next-js-how-to-fix-the-error-constructor-requires-new-operator/

MLA
" » Next.js, how to fix the error `Constructor requires ‘new’ operator`." flaviocopes.com | Sciencx - Friday July 9, 2021, https://www.scien.cx/2021/07/09/next-js-how-to-fix-the-error-constructor-requires-new-operator/
HARVARD
flaviocopes.com | Sciencx Friday July 9, 2021 » Next.js, how to fix the error `Constructor requires ‘new’ operator`., viewed ,<https://www.scien.cx/2021/07/09/next-js-how-to-fix-the-error-constructor-requires-new-operator/>
VANCOUVER
flaviocopes.com | Sciencx - » Next.js, how to fix the error `Constructor requires ‘new’ operator`. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/07/09/next-js-how-to-fix-the-error-constructor-requires-new-operator/
CHICAGO
" » Next.js, how to fix the error `Constructor requires ‘new’ operator`." flaviocopes.com | Sciencx - Accessed . https://www.scien.cx/2021/07/09/next-js-how-to-fix-the-error-constructor-requires-new-operator/
IEEE
" » Next.js, how to fix the error `Constructor requires ‘new’ operator`." flaviocopes.com | Sciencx [Online]. Available: https://www.scien.cx/2021/07/09/next-js-how-to-fix-the-error-constructor-requires-new-operator/. [Accessed: ]
rf:citation
» Next.js, how to fix the error `Constructor requires ‘new’ operator` | flaviocopes.com | Sciencx | https://www.scien.cx/2021/07/09/next-js-how-to-fix-the-error-constructor-requires-new-operator/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.