You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeError: Missing parameter name at 2: https://git.new/pathToRegexpError #6428
Platform: Linux 6.8.0-1021-aws 23~22.04.1-Ubuntu SMP Tue Dec 10 16:50:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Node.js version: v16.20.2
Any other relevant information: N/A
What steps will reproduce the bug?
# Installing the latest express cause the issue
npm install express
then throws error
TypeError: Missing parameter name at 2: https://git.new/pathToRegexpError
at name (/var/www/<project>/node_modules/path-to-regexp/dist/index.js:73:19)
at lexer (/var/www/<project>/node_modules/path-to-regexp/dist/index.js:91:27)
at lexer.next (<anonymous>)
at Iter.peek (/var/www/<project>/node_modules/path-to-regexp/dist/index.js:106:38)
at Iter.tryConsume (/var/www/<project>/node_modules/path-to-regexp/dist/index.js:112:28)
at Iter.text (/var/www/<project>/node_modules/path-to-regexp/dist/index.js:128:30)
at consume (/var/www/<project>/node_modules/path-to-regexp/dist/index.js:152:29)
at parse (/var/www/<project>/node_modules/path-to-regexp/dist/index.js:183:20)
at /var/www/<project>/node_modules/path-to-regexp/dist/index.js:294:74
at Array.map (<anonymous>)
/var/www/<project>/node_modules/path-to-regexp/dist/index.js:73
throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`);
Missing parameter name
Parameter names must be provided after : or *, and they must be a valid JavaScript identifier. If you want an parameter name that isn't a JavaScript identifier, such as starting with a number, you can wrap the name in quotes like :"my-name".
Yep, as @slagiewka says, please read our migration guide. v5 is a breaking upgrade, and you will need to make some changes to the path syntax you use. If you still think this is a bug after addressing the changes from the guide, please post the route definitions you have and we can take a look. I will leave this open only because I anticipate more folks asking the same question, but will remove the bug label as this is likely not a bug.
I had this problem aswell and can confirm that this is "simply" a breaking change from the V5 update.
As described in the changelogs here routes like app.use('/**', ...) are not supported anymore.
This problem came up while updating express in an Angular SSR application for me. When setting up SSR, Angular generated exactly the example mentioned above for me. But changing it to app.use('/{*path}', ...) fixed the problem for me. 👍
Screenshot from the migration section of the express homepage:
Reacted by Quincy Koots, Jaluanda, Marcos Gasparini, Ayhan Aksoy, Nelson Kuria, Juan Camilo US, Kamel Mustapha, Zé, Randika Geekiyanage, Julien Maulny and 7 more
Reacted by vinicius frança
Reacted by Erik Horn
Reacted by Jericho Aquino, Quincy Koots, Randika Geekiyanage, Julien Maulny, Akshay Rawal and Sanaruca
Thanks @wesleytodd and @slagiewka, I confirmed that it is a breaking issue with the new version.
As for our usecase we only have this one route, that accepts all requests and send in the index.html of our frontend build, and you guys are correct, this one is causing the issue.
I opened this issue yesterday because we have to rollback our production and it cost us downtime and delay our app release thinking it's a fault on our recent changes.
Funny enough, it's our mistake, we have this untouched code in our Dockerfile for ~5 years now and a package-lock.json is not generated until deployment as we do the expressjs installation on docker build, basically it's always installing the latest version 😭.
RUN npm install express
With this, I conclude that this issue is resolved, you guys can close this anytime if no one wants to add more. I just hope no major impact to production servers out there because of silly mistakes like what we did.
@eru123 same with me I am using express to serve my react build and last 3-year code was working but because I also face same issue after this critical issue, I realize does not matter how much contributor are working on any lib it can have major issue after whole application.
This is true of all libraries, you have benefited these past years from the stability (and stagnation 😉) of the project. If you are doing something like npm install express in your build you need to specify a version you rely on. Change that to npm install express@5 now and then when we release v6 which will also include breaking changes you will avoid this pain.
I will still keep this open for now, because it avoids more duplicate issues, but glad to hear your issue is resolved @eru123!
I had the same issue, and I worked around it using a regex: app.get(/.*/, (req, res) => { res.sendFile(path.resolve(__dirname, "frontend", "index.html")); });
Not sure if this will solve your problem too, but it worked for me!
@bjohansebas I tested it here, and it worked for me too! I haven’t gone deep into the discussion, but I noticed there are three workarounds for this problem. Among these—{/{splat}},{ /./}, and {'/*\w'} —which one is the most recommended?
I had the same issue, and I worked around it using a regex: app.get(/.*/, (req, res) => { res.sendFile(path.resolve(__dirname, "frontend", "index.html")); });
Not sure if this will solve your problem too, but it worked for me!
man thats freaking helpful , i was seacrhing for this from hours i added '/.*/' it added undeined like my fetchURl + undeined + route , so i just set the fecthing of data without fetch url. I was stuck to this for hours man
Activity
MrShadow50 commentedon Apr 1, 2025
yes I got also same issue
slagiewka commentedon Apr 1, 2025
I you go to the DEBUG_URL: https://git.new/pathToRegexpError
You will see in the README:
I would assume that your route contains
*. Please confer the migration guide before opening issues: https://expressjs.com/en/guide/migrating-5.html#path-syntaxPS:
Node.js version: v16.20.2please note that express v5 requires node v18. Also note that node v16 has ben EoL since September 11th, 2023.wesleytodd commentedon Apr 1, 2025
Yep, as @slagiewka says, please read our migration guide. v5 is a breaking upgrade, and you will need to make some changes to the path syntax you use. If you still think this is a bug after addressing the changes from the guide, please post the route definitions you have and we can take a look. I will leave this open only because I anticipate more folks asking the same question, but will remove the
buglabel as this is likely not a bug.NetWin commentedon Apr 1, 2025
I had this problem aswell and can confirm that this is "simply" a breaking change from the V5 update.
As described in the changelogs here routes like
app.use('/**', ...)are not supported anymore.This problem came up while updating express in an Angular SSR application for me. When setting up SSR, Angular generated exactly the example mentioned above for me. But changing it to
app.use('/{*path}', ...)fixed the problem for me. 👍Screenshot from the migration section of the express homepage:
eru123 commentedon Apr 2, 2025
Thanks @wesleytodd and @slagiewka, I confirmed that it is a breaking issue with the new version.
As for our usecase we only have this one route, that accepts all requests and send in the
index.htmlof our frontend build, and you guys are correct, this one is causing the issue.I opened this issue yesterday because we have to rollback our production and it cost us downtime and delay our app release thinking it's a fault on our recent changes.
Funny enough, it's our mistake, we have this untouched code in our
Dockerfilefor ~5 years now and apackage-lock.jsonis not generated until deployment as we do theexpressjsinstallation on docker build, basically it's always installing the latest version 😭.With this, I conclude that this issue is resolved, you guys can close this anytime if no one wants to add more. I just hope no major impact to production servers out there because of silly mistakes like what we did.
MrShadow50 commentedon Apr 2, 2025
@eru123 same with me I am using express to serve my react build and last 3-year code was working but because I also face same issue after this critical issue, I realize does not matter how much contributor are working on any lib it can have major issue after whole application.
wesleytodd commentedon Apr 2, 2025
This is true of all libraries, you have benefited these past years from the stability (and stagnation 😉) of the project. If you are doing something like
npm install expressin your build you need to specify a version you rely on. Change that tonpm install express@5now and then when we release v6 which will also include breaking changes you will avoid this pain.I will still keep this open for now, because it avoids more duplicate issues, but glad to hear your issue is resolved @eru123!
wesleytodd commentedon Apr 2, 2025
In fact, I just pinned this issue so that folks are more likely to see it than to open a new one.
fix: Missing parameter name at 9: for freshly created CLI apps. Fix b…
17 remaining items
detobel36 commentedon May 4, 2025
For people who use Angular, the upgrade has been done here: angular/angular-cli#29989
rajneeshshukla1608 commentedon May 31, 2025
Go back to previous version this will fix the error
Kaike-R commentedon Jun 18, 2025
Hey everyone,
I had the same issue, and I worked around it using a regex:
app.get(/.*/, (req, res) => { res.sendFile(path.resolve(__dirname, "frontend", "index.html")); });Not sure if this will solve your problem too, but it worked for me!
denniac commentedon Jun 18, 2025
I had the same issue upgrading to
Express 5withAngular 20and nodelts/jod (v22.16.0); I had to roll back toexpress@4.21.2.bjohansebas commentedon Jun 21, 2025
hey @Kaike-R @Deni8dev Changing the route to
/{*splat}, doesn't it work?Kaike-R commentedon Jun 26, 2025
@bjohansebas I tested it here, and it worked for me too! I haven’t gone deep into the discussion, but I noticed there are three workarounds for this problem. Among these—{/{splat}},{ /./}, and {'/*\w'} —which one is the most recommended?
tagobuyhelp commentedon Jul 23, 2025
I have been trying to fix this problem for three to four hours and after seeing this post, I got the temporary fix and got the job done for now.
RijanDhakal commentedon Jul 31, 2025
man thats freaking helpful , i was seacrhing for this from hours i added '/.*/' it added undeined like my fetchURl + undeined + route , so i just set the fecthing of data without fetch url. I was stuck to this for hours man
ikwijaya commentedon Aug 12, 2025
still issue for me today
express 5.1.0
the error in console

RijanDhakal commentedon Aug 15, 2025