JavaScript errors
- Each child in a list should have a unique "key" prop.You rendered an array of elements in React (usually with .map) without giving each element a stable, unique key prop, or two elements share the same key.
- Expected 1 arguments, but got 0. ts(2554)You called a function, method or constructor with a different number of arguments than its TypeScript signature declares. Either pass the right arguments or change the signature (optional, default or rest parameters).
- Hydration failed because the initial UI does not match what was rendered on the serverIn Next.js (or any React SSR), the HTML React renders in the browser on first load differs from the HTML the server sent. Caused by browser-only values (window, Date, Math.random, localStorage) used during render, or invalid HTML nesting.
- Maximum update depth exceededA React effect or lifecycle method updates state, which re-renders, which runs the effect again, forever. Usually a useEffect without a dependency array, or a dependency that is a new object/array/function on every render.
- Module not found: Error: Can't resolvewebpack (used by Create React App, Next.js, Angular, Storybook...) couldn't find a file or package you imported. The path or case is wrong, the package isn't installed, an alias isn't configured, or it's a Node core module that webpack 5 no longer polyfills.
- Object is possibly 'undefined'. ts(2532)TypeScript strict null checks found a value whose type includes undefined (or null) being used as if it were always defined. Narrow the type, provide a default, or fix the type.
- Objects are not valid as a React childYou tried to render a plain object, Date, or Promise directly inside JSX. React can only render strings, numbers, elements, arrays of those, null and booleans.
- Property 'x' does not exist on type 'Y'TypeScript only lets you access properties it knows exist on a value's type. The type is too narrow (often `{}` or a union), the property is missing from your interface, or a DOM/global type needs to be narrowed or extended.
- React Hook useEffect has a missing dependencyThe ESLint rule react-hooks/exhaustive-deps found a value used inside useEffect (or useCallback/useMemo) that isn't listed in the dependency array, which can make the effect run with stale values.
- ReferenceError: require is not definedrequire() only exists in CommonJS. In ES modules and browsers, use import, or create require with createRequire.
- ReferenceError: x is not definedYou used a variable or function name that doesn't exist in the current scope. Typo, missing import, script loaded in the wrong order, browser-only global used in Node (or vice versa), or a variable defined inside another block.
- SyntaxError: Cannot use import statement outside a moduleNode (or a test runner) is treating your file as CommonJS. Set "type": "module", use .mjs, or switch to require().
- SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSONYou called response.json() but the server returned HTML (an error page, a 404, or your app's index.html). Check the URL and the response status.
- Too many re-renders. React limits the number of renders to prevent an infinite loop.A state setter is being called during render, which triggers another render, which calls it again. Usually it's an onClick that calls a function instead of passing one.
- TS2307: Cannot find module or its corresponding type declarations.The TypeScript compiler can't resolve an import to a file or a type declaration. The package is missing, it ships no types, the file type isn't declared, or a path alias isn't configured.
- TS2322: Type 'X' is not assignable to type 'Y'TypeScript found a value whose type doesn't fit the declared type of the variable, property, return value or prop it's assigned to. The indented lines under the error tell you exactly which part doesn't fit.
- TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.TypeScript found a function call whose argument type doesn't match the parameter type. Most often a possibly-undefined or possibly-null value is passed where a definite value is required, or a wide type (string) is passed where a narrow one (a union of literals) is expected.
- TS7016: Could not find a declaration file for moduleThe package is installed and its JavaScript was found, but it ships no TypeScript types and there is no @types package installed, so with noImplicitAny on TypeScript refuses to treat it as any.
- TypeError: Cannot read properties of undefined (reading 'x')You accessed a property on a value that is undefined. The data isn't loaded yet, the object path is wrong, or a function returned nothing.
- TypeError: x is not a functionYou called something with () that isn't a function, e.g. .map on an object instead of an array, a misspelled method, a wrong import, or a variable that shadows the function.