Fix ESLint: Module.createRequire is not a function
Reproduced on Node 10 vs Node 18 with the same node_modules: the crash is the Node runtime executing ESLint, not Parcel or a broken module resolution.
Explore our curated collection of articles, insights, and stories about TypeScript.
Reproduced on Node 10 vs Node 18 with the same node_modules: the crash is the Node runtime executing ESLint, not Parcel or a broken module resolution.
Why adding a property to exports and then requiring it without destructuring hands you an object instead of a constructor, reproduced on current Node.js.
Reproduce the ownership mismatch behind the warning, see how a current npm install actually fails, and fix the layer that creates it.
Reproduced on Windows 11 with a virtual drive: the exact failing version, why @next still breaks today, and the command that migrates a v3 project cleanly.
Separate an npmrc parsing failure from registry authentication, with reproduced npm and Yarn Classic controls and a secret-safe CI fix.
Separate a missing Sass compiler from a webpack loader, an omitted build dependency and a Tailwind integration error before changing your configuration.
Find the process or path preventing a pnpm rename, distinguish a locked package from a version regression, and retain the dependency resolution.
Find the mismatched workspace importer, align the pnpm version, and prove the repaired lockfile installs without changing a byte.
A current client bundle reproduces the carousel import failure before hosting, then renders successfully after changing only the component value.
Separate oversized generated CSS from plugin cost, with a single-change compiler reproduction and an Autoprefixer negative control.
Read both paths in the rename error, preserve your lockfile, and distinguish a stale retirement directory from an npm regression or a file lock.
Reproduce a missing SQLite binding, approve only its installer, and keep the same permission working in CI without enabling every dependency script.
Trace an absent grid utility through a production build, replace the legacy safelist, and include shared UI classes without generating every combination.
Check the Node binary that actually starts Vite, distinguish API availability from the supported version range, and verify the fix without replacing the lockfile.
Keep mock return values checked against the real function signature, and verify both TypeScript compilation and module mocking at runtime.
Repair the missing errors property without losing nested paths, hiding validation failures or turning unexpected exceptions into form errors.
Why an import that already matches moduleDirectories still throws Cannot find module: a failing test, then a passing one, for two different fixes.
Why cloning a repository never brings its dependencies with it, and the one command that turns a missing-binary failure into a working start script.
Find which of Node, the compiled addon and the system library is on the wrong CPU architecture, line them up, and know what the follow-up errors mean.
Find which of the three causes threw the error, from the value printed after the colon, and make toLocaleString and Intl.DateTimeFormat accept the zone again.
Get a NestJS start:dev script that calls dotenv -e running again, and avoid the dotenv 18 binary that now answers with a usage screen instead.
Why a lint script that adds Airbnb ESLint config with Yarn dies on Windows with ERR spawn EINVAL, the one-word change that makes it run, and what the fixed release does to your version ranges.
Why the font-inter class exists but the text stays in the default face in a React and Vite project, and the one-line move that makes the browser download Inter.
Why Owl Carousel works under the Vite dev server but dies in dist, and the two changes a fresh npm install now needs before the carousel loads again.
Tell in one request whether Vite itself answered 404 or another server did, then move index.html, pin the host or free the port, and confirm it with curl.
Read the Required and Actual lines, distinguish npm self-upgrades from application installs, and stop a floating npm release breaking an unchanged Dockerfile.
Separate a local lockfile permission failure from cache and global-install errors, then fix the owner without changing the dependency tree.
Reproduce a dependency scan that includes gitignored documentation, then narrow the entry list without hiding syntax errors in the application itself.
Get babel-jest loading your Babel config again in a "type": "module" project, and see which Node versions never hit the error at all.
Reproduce the broad typeRoots mistake, distinguish it from missing @types packages, and preserve custom global declarations while repairing tsconfig.
Separate a library bundling mistake from linked-package resolution, keep React external, and prove that the component and renderer use the same React.
Match the prop name on both sides of the component boundary to stop the crash, and see why optional chaining or a default value only hides it instead.
What Phusion Passenger's own loader script does, why it throws ERR_REQUIRE_ESM on an ESM app.js, and the fix, reproduced on Node 14, 18 and 22.
Why replacing react-app with airbnb drops the TypeScript parser Create React App quietly provided, and the one-line fix for both flat config and the now-removed .eslintrc format.
Stop ESLint from type-checking your compiled dist output, and avoid the newer project-vs-projectService conflict that now hides this exact message.
Why vite vanishes from node_modules after a clean install, reproduced on npm 9.5.0 and Node 18 with a global vite install, plus the extra step the fix needs to outlast the next npm install.
Reproduced on @nestjs/jwt 12.0.3 and 10.0.3: why a configured JwtModule still signs with an empty key, why two popular answers fall short, and the .env load-order variant of the same error.
Reproduced with Node's own ES module loader: why the browser's loader finds no export in a tsc CommonJS build, and why two of the three moduleResolution values the top answer lists don't compile.
See why only Chrome stalls on a big Vite app while Firefox loads it, reproduce the stall with one changed limit, and make the fix survive a reboot.
Why curl fails to resolve a host in a RUN step on one server and not on your laptop, how to prove it is the engine and not the image, and which fix to pick.
Why a hand-written declaration for an untyped package fails with "cannot be augmented", why the same block works in a .d.ts but not a .ts file under module node16 to nodenext, and the one-line move that fixes it.
Read the exact wording of the error to learn which runtime ran your code, then choose between upgrading Node and staying on CommonJS with a pinned dependency.
How to confirm the broken libnpmfund file in under a minute, why only npm 8.3.1 and later trip on it, and the reinstall that actually repairs the Node version you already have.
Why one broken folder under node_modules/@types fails the whole project, why restarting VS Code sometimes clears it, and what TypeScript 6.0 changed.
Find which package ships the broken source map, fix it at the source if it is yours, and silence it precisely if it is not, without losing your own debugging.
Why a types release from 2 September 2020 broke TypeScript 2.x builds overnight, why skipLibCheck does not help, and two fixes reproduced in Docker.
Why nvm install works and nvm use does not on nvm-windows 1.x, what Windows actually refuses, and three fixes: one elevated shell, Developer Mode with a user-owned symlink, or v2.
Why a Sass CSS module ships a literal @apply line into Storybook with no error, why importing globals.css does not change it, and the one-loader fix, reproduced on webpack 5.
Why npx shadcn add creates a literal @renderer folder or writes outside your project in electron-vite and WXT apps, and three fixes reproduced on shadcn 4.22.1.
Reproduced on npm 10.9.9 against a server that accepts the connection and never replies: what each log level shows, why fetch-timeout does not end the wait, and the one-line fix.
Why yarn install in a node:18 container dies in node-gyp with ERR_REQUIRE_ESM from wide-align, how to spot the broken yarn.lock entry, and two fixes reproduced in Docker.
Why a Vite 6 project stops before the dev server starts, why reinstalling from the same lockfile brings the error back, and the one-line update that clears it.
Two working loaders for a folder of Express route files, one synchronous and one async, plus the startup-order bug that forEach with import() hides. Reproduced in Docker.
Find which of the two triggers crashes npm start, pick a fix that still proxies your API calls, and avoid the http-proxy-middleware v3 path trap.
Get grpc_tools_node_protoc running on an Apple Silicon Mac, understand why every workaround still needs Rosetta 2, and check which binary actually landed in node_modules.
Make a recursive union type compile inside generic functions again, without losing the payload checks on concrete modules.
Find out in two commands whether the built CSS really lacks your classes or the browser never loaded it, then apply the one change that fixes each case.
Why vite dev works but vite build fails on a top-level await, which setting fixes the build and which one only fixes dev, reproduced on Vite 2.9, 5.4, 7.3 and 8.3.
Why vite dev fails in a node:16-slim container with a mounted frontend folder, why npm rebuild esbuild works there but not on current Vite, and the compose change that holds.
Why tsc compiles an @alias import cleanly and Node still crashes on it, and five runtime fixes tested on Node 22 with TypeScript 5.9.3 and 7.0.2.
Why DevTools shows your Tailwind font family while the text stays in the default face, and the two-line @font-face change that makes the file load.
Keep the Cypress folder out of the root tsconfig, as Cypress recommends, and still lint every .cy.ts file with type information.
Why npm install of esbuild started failing with ETXTBSY on node:20.3 images in June 2023, what changed in libuv and Docker since, and the build fix that holds today.
Read the path in the warning, find the stray package.json above your project, and silence the line without inventing an open-source licence.
Three fixes for import.meta.env in Jest tests of a Vite app, each reproduced, plus the secret-leak trap in the popular process.env answer.
Stop waiting on an emulated arm64 build to time out the job: three fixes, in the order that actually removes the wait instead of just hiding it.
A postcss.config.js that lists plugin names as plain strings compiles nothing — the array syntax needs each entry already resolved, not a package name.
Reproduce the exact failure in a clean container, then pick the right fix: skip the transport outside production, install pino-pretty as a real dependency, use it as a stream, or wire up a bundler plugin.
A fresh MikroORM 5/6 project throws a ValidationError on the first em.create() call. Here is why the global EntityManager is blocked, and the two ways to fix it properly.
Your envsubst step ran while the image was built, long before the container got its variables. A small entrypoint script runs it at start-up instead and still hands control to npm or node.
Separate a successful type check from a callable runtime import, and avoid the namespace workaround that fails when interop is enabled.
Prove that the utility exists but loses the CSS cascade, restore spacing with one layer change, and inspect the child margins behind space-x.
Read the package refusing your installed React version, distinguish the alternative candidate from the selected version, and preserve a verifiable lock file.
Keep one bg-bgContrast class while changing its inherited colour, with real browser checks for the wrong theme syntax and the inline-token trap.
Why each define line only reveals the next error with fs-extra (reproduced on Vite 2.9.5), which shim works for Buffer-based libraries on Vite 2 and 8, and how to type it.
Which axios releases trigger TS2304, why upgrading axios no longer clears it, and the tsconfig fixes reproduced on TypeScript 4.5.2 and 7.0.2.
Why Node throws ERR_UNSUPPORTED_DIR_IMPORT under "type": "module", three fixes reproduced on Node 24, and why the old specifier flag no longer helps.
Why an Express app with "type": "module" cannot find ./config/app, why the flags from older answers now do nothing, and how TypeScript catches it at compile time.
Why vite build fails on react-router-dom while vite dev works, which define line triggers it, and a polyfill setup that builds, reproduced on Vite 2.9.12.
Find which Node actually runs tsc, move it to a supported runtime or pin a compiler that matches it, and avoid the different error a plain npm install -g typescript now gives on Node 12 and 14.
Reproduced on Vite 3, 4, 7 and 8: why a CommonJS dependency makes vite build stop on a package entry, why the odd "main" field is not the cause, and three fixes that each work on their own.
Why a Vite 6 project that builds fine refuses to load the Tailwind CSS v4 plugin, reproduced step by step, with the two one-line fixes and the variant newer plugin releases print.
When reinstalling node_modules changes nothing, read the [cause] line: the Rollup binary is there, Windows just cannot load one of its DLLs.
Why renaming to gulpfile.mjs still fails on Node 24 with gulp 4, what changes on newer Node, and three fixes reproduced in Docker.
Reproduced on npm 11.19.0: how to tell the cache EACCES from the global-install EACCES by the path line, and the two fixes npm documents that end sudo for good.
Read the peer range npm prints, install it into your app with one command, and see why the same project installs cleanly on npm 7 and later.
Find the old node-gyp hiding in your lockfile, see why pointing it at Python 3 or Python 2 no longer works, and get yarn install green again with Dart Sass.
Find which package.json carries the short version, rewrite it as major.minor.patch, and know which npm commands check the field on old and current npm.
Why the ts-node frame appears, why the dynamic import() the error suggests still fails under module commonjs, and five fixes tested on Node 18 and 24.
Reproduced in Docker: why the cache directory cannot be created, the one-line Dockerfile move that fixes it, and why an old volume keeps the error alive after a rebuild.
Find the heap cap your build actually runs under, raise it in the place that reaches the crashing process, and avoid the two spellings that silently change nothing.
Make a Babel-based Node app start on Heroku: see what the Node.js buildpack removes after the build, then move the compile step to build time so npm start only needs node.
Prove that TypeScript is installed, then make Command Prompt and VS Code build with that project version without a global compiler.
Reproduce a Docker build failure caused by excluded HTML, then repair the context with a single ignore-file exception.
Find which layer has stopped working: Tailwind project discovery, document mapping, or automatic suggestions inside JSX strings.
How Node decides CommonJS vs ES module, and three remedies for aligning source syntax, compiler output and the runtime.
The fix depends on whether the stale uuid build is yours or a transitive dependency's — here is how to tell, and the exact config for each case.
Stop fighting indent: Expected indentation of 2 spaces but found 4 by turning off the rule that conflicts with Prettier, not by retuning it.
A Next.js build that finishes clean but ships a page with zero Tailwind styling almost always has one wrong setting: the paths Tailwind scans for class names.
Trace the import that brings a native addon into the dev scan, and distinguish the tested Vite 4 behaviour from newer bundlers.
Make @typescript-eslint/no-explicit-any go quiet for the right reason: a scoped disable that ESLint actually reads, a config override, or a real type.
Find the import loop behind the ReferenceError with madge, then cut the one edge that points from the base class back to its subclasses.
What shadcn init actually looks for before it says Tailwind is missing, reproduced on Tailwind 3 and 4 with the one line that fixes each.
Reproduced on Tailwind 4.1.4 to 4.3.3 and 3.4.19: the four wordings of this error, the @config path that resolves, the hsl() trap in @theme, and the two v3 causes.
Why a clean npm install turns a working Vite + Tailwind build into three errors at once, reproduced one at a time with the fix for each.
Match the import form to the Node.js release that runs your code, make tsc flag the missing attribute at build time, and handle the two errors that come next.
Your Express 5 server crashes at start-up. One changed route string brings it back, and on current installs the message itself names the route to change.
Find out where your node_modules came from, reinstall it for the machine that runs Vite, and avoid the popular fix that breaks Linux CI and Docker builds.
Find which part of your build still asks for MD4, apply the one-line workaround to unblock a deploy, then remove it with a webpack or react-scripts upgrade.
Read the two environment lines in the error, rebuild the binding for the Node that actually runs your build, and know when the only real fix is moving to Dart Sass.
Read the package exports map, tell a private deep import from an import-only entry, and pick the one change that makes the require or import resolve.
Learn which of the three checks node-gyp runs on macOS is failing, repair the Command Line Tools, and get native modules compiling again.
Vite strips anything not prefixed VITE_ out of the client bundle on purpose — here is how to confirm that's the cause and the three ways to fix it.
Access Jest's mocking object in native ESM tests without confusing it with the test, expect and global names that remain available by default.
Read one line of the tsc output to tell a missing package from a resolution setting, then fix vite.config.ts in the tsconfig that actually owns it.
The warning is informational and harmless. Silence it for good in an application, fill it in properly for a library, and know why modern npm no longer prints it.
The exact steps to resolve the Tailwind v4 PostCSS plugin relocation error in a Vite + React + TypeScript build.
console.log fails to type-check in a Node project. See which two tsconfig settings hide console, why the compiler hint points the wrong way, and the fix.
Vite build fails with 'Rollup failed to resolve '/src/main.tsx'' when index.html is placed inside src and the script tag uses an absolute path. Fix it by correcting the file structure.
The 'originalKeywordKind' DeprecationError fires when @typescript-eslint packages are stuck on v5 while TypeScript moved on. Upgrade to v6.x and restart ESLint to clear it.
A tsconfig "paths" alias that works with the TypeScript compiler but breaks Create React App's build. Why CRA specifically forbids it, and three ways to keep clean "@/..." imports anyway.
Drizzle schema files make tsserver grind to a halt on large table sets. Here are the upgrade and cast trick that restore completions.
The tsconfig jsx option is set, but the editor still reports the JSX flag error. Here's how to force VS Code to use the project's TypeScript version and apply the change.
The import/extensions error appears when the eslint-plugin-import package isn't loaded. Register the plugin and extend airbnb-base to resolve it.
TypeScript throws TS7053 when a plain string indexes a typed object. Use keyof typeof, index signatures, or Record to fix it safely.
TypeScript blocks union types in index signatures. Learn why the error fires and how to fix it with mapped types or the Record utility type in under a minute.
Run tsc --noEmit on a project that compiles fine in the editor and the terminal lights up with type errors from inside node_modules. The fix is skipLibCheck, plus two
TypeScript 6.0 shipped in March 2026 with strict mode on by default and several legacy options removed. Here is what actually breaks migrating a real Next.js + Supabase codebase, in the order to fix it.
The @/* alias fails in four different places for four different reasons. A 60-second checklist, then a fix per resolver: Next.js build, TS server, Jest and ESLint.
After npm install typescript@latest, builds break with Cannot find module @types/node or Property auth does not exist on SupabaseClient. The cause is a type-definition mismatch, not Node.js — here is the alignment fix.
TypeScript getter/setter errors come from ES target misconfiguration or type mismatches. Fix TS1056, TS1028, and TS2378 in minutes.
Fix TS2322 by understanding when ReactNode, JSX.Element, and ReactElement apply in React + TypeScript component typing.
TS7016 fires when you import an untyped JavaScript module under noImplicitAny. The right fix is usually `npm i -D @types/X` — but sometimes the package already ships types, and sometimes you need to write a one-line declaration.
TS2305 says the export you're importing doesn't exist under that name. The cause is almost always one of: a typo, default-vs-named confusion, a CJS/ESM interop mismatch, or @types drifting from the runtime package. Each has a precise fix.
TS2564 fires when a class field is typed but never guaranteed to be set. The fix depends on WHY it's unset: a default value, constructor assignment, the definite-assignment `!`, or an optional `?`. Picking the wrong one hides real bugs.
Learn how to safely extend the Window interface in TypeScript with declaration merging and declare global, and why bracket notation on an undeclared key fails under noImplicitAny.
Stop getting NaN or type errors when converting strings to numbers in TypeScript. Use parseInt, Number(), unary +, and runtime guards safely.
The TypeScript ! operator asserts non-nullability but bypasses type safety. Learn when it breaks, why it's dangerous, and safer alternatives.
Stop guessing which to use: interfaces or types in TypeScript. This guide shows exactly when each shines, with concrete examples and migration tips.
Master end-to-end type safety in Next.js with Supabase. Learn database type generation, Zod validation, type-safe queries, and TypeScript patterns for production apps.
Migrate a JS codebase to TypeScript file-by-file — no full rewrite required. The tsconfig settings, file order, and tricks for handling untyped packages along the way.