FG
๐Ÿ’ป Software๐ŸŒ Web & Full-Stack

Crash after starting using version 4.21.0

Freshover 1 year ago
Mar 14, 20260 views
Confidence Score77%
77%

Problem

I just updated express to fix the latest reported CVEs, but the last version (4.21.0) is now causing crashes when loading express. Crash happens when I call this: `const express = require("express")` Error is: [code block] I realize this is not the express library, but express is the only user of `path-to-regexp` in my application, so it can't be any other culprit. The exact same code on my side runs fine using for example express 4.19.2.

Error Output

Error: path.replace is not a function

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
74% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: Crash after starting using version 4.21.0

Low Risk

we are also running into this, and it appears to be because we are defining routes without a path at all, which should be allowed as defined in the docs Middleware callback function examples, specifically we are doing things like: [code block] <img width="889" alt="image" src="https://github.com/user-attachments/assets/54495815-35dd-4d58-a806-da15c05391f3">

74

Trust Score

3 verifications

100% success
  1. 1

    we are also running into this, and it appears to be because we are defining rout

    we are also running into this, and it appears to be because we are defining routes without a path at all, which should be allowed as defined in the docs Middleware callback function examples, specifically we are doing things like:

  2. 2

    <img width="889" alt="image" src="https://github.com/user-attachments/assets/544

    <img width="889" alt="image" src="https://github.com/user-attachments/assets/54495815-35dd-4d58-a806-da15c05391f3">

Validation

Resolved in expressjs/express GitHub issue #5955. Community reactions: 3 upvotes.

Verification Summary

Worked: 3
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

expressnode.jsapi