9.1.5 path-to-regexp error with static routes
Bug report
Describe the bug
Ok i'll try again.
After i upgraded next to 9.1.5 from 9.1.4 i can`t run it in production. I got express and my command is NODE_ENV=production node server.js
And it gives me:
.../node_modules/next/node_modules/path-to-regexp/dist/index.js:113 throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type); ^
TypeError: Unexpected MODIFIER at 72, expected END at mustConsume (.../node_modules/next/node_modules/path-to-regexp/dist/index.js:113:15) at parse (.../node_modules/next/node_modules/path-to-regexp/dist/index.js:172:9) at stringToRegexp (.../node_modules/next/node_modules/path-to-regexp/dist/index.js:329:27) at pathToRegexp (.../node_modules/next/node_modules/path-to-regexp/dist/index.js:403:12) at Object.match (.../node_modules/next/node_modules/path-to-regexp/dist/index.js:248:14) at Object.route (.../node_modules/next/dist/next-server/server/lib/path-match.js:6:42) at .../node_modules/next/dist/next-server/server/next-server.js:386:37 at Array.forEach () at Server.generatePublicRoutes (.../node_modules/next/dist/next-server/server/next-server.js:381:21) at Server.generateRoutes (.../node_modules/next/dist/next-server/server/next-server.js:146:20)
Also: now after my yarn.lock or package.lock changed i get this error no matter what 9 version of next i install. On 8 version there is no such error
The bug happening when you try to create routes to your static content in production environment. There was no such error before you upgraded dep path-to-regexp to 6 version. It was 3 in 9.1.4
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npx create-next-app --example custom-server-express custom-server-express-apporyarn create next-app --example custom-server-express custom-server-express-app- Create public folder
- Create svg file with content
<svg width="23" height="10" viewBox="0 0 23 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.5" d="M3.9834 10H2.71191V1.57129L0.162109 2.50781V1.35938L3.78516 -0.000976562H3.9834V10ZM13.0273 6.65723H14.4082V7.68945H13.0273V10H11.7559V7.68945H7.22363V6.94434L11.6807 0.046875H13.0273V6.65723ZM8.65918 6.65723H11.7559V1.77637L11.6055 2.0498L8.65918 6.65723ZM19.3027 4.66113H22.0781V5.85742H19.3027V9.00195H18.0312V5.85742H15.2559V4.66113H18.0312V1.75586H19.3027V4.66113Z" fill="black"/>
</svg>
- Put that svg in public folder
- Run
NODE_ENV=production node server.js
Expected behavior
Route created for static svg -> server started
System information
- OS: MacOS 10.15
- Version of Next.js: 9.1.5
I cannot reproduce with the instructions given. The SVG loads fine:

See setup:

Oh i got it. Try to change name test.svg to 14+.svg The problem here in naming with special symbols i guess
How to reopen it?
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.