Crash after starting using version 4.21.0
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
Solution: Crash after starting using version 4.21.0
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">
Trust Score
3 verifications
- 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
<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
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep