next.js: [v15] Module parse failed: Bad character escape sequence
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/condescending-haze-go8s7s
To Reproduce
- run this commad:
npx create-next-app@latest - This will install latest version of nextjs like in package.json is
"dependencies": { "react": "19.0.0-rc-65a56d0e-20241020", "react-dom": "19.0.0-rc-65a56d0e-20241020", "next": "15.0.0" }, "devDependencies": { "typescript": "^5", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "postcss": "^8", "tailwindcss": "^3.4.1", "eslint": "^8", "eslint-config-next": "15.0.0" } - npm run dev
- browser showing error `Module parse failed: Bad character escape sequence (11:57) | const fileSizeInMB = buffer.byteLength / 1024 / 1024
`
Current vs. Expected behavior
I have just not changed any default value during app creation like shown in screenshot
it should spin up dev server without error. which it dose but after within seconds error pop out.
Provide environment information
test
Which area(s) are affected? (Select all that apply)
create-next-app
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
When i step down to version 14 its working fine with 14.2.15 npx create-next-app@14 test-project
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 28 (15 by maintainers)
Commits related to this issue
- fix: metadata image route Windows path escaping (#71615) ### Why? When handling the `opengraph-image` size exceeding the limit, we mapped with string literal between Rust and JavaScript. The Rust... — committed to zhouzhi3859/next.js by devjiwonchoi 2 years ago
- fix: metadata image route Windows path escaping (#71615) ### Why? When handling the `opengraph-image` size exceeding the limit, we mapped with string literal between Rust and JavaScript. The Rust... — committed to sanity-io/next.js by devjiwonchoi 2 years ago
- fix: metadata image route normalize path posix for windows (#71673) ### Why? When handling the opengraph-image size exceeding the limit, we mapped with string literal between Rust and JavaScript.... — committed to vercel/next.js by devjiwonchoi 2 years ago
- fix: metadata image route normalize path posix for windows (#71673) ### Why? When handling the opengraph-image size exceeding the limit, we mapped with string literal between Rust and JavaScript.... — committed to sebmarkbage/next.js by devjiwonchoi 2 years ago
Hey everyone, v15.0.2 is out with the fix. Please give it a try and lmk!
This is also what “fixed” it for me. Should definitely not run into that error for having a favicon.ico file…
I deleted favicon.ico and it returned to normal operation.
npx rimraf .nextand then running next server should be working.I just tried this, not working.
@faisalrehmanlums Hi, https://github.com/vercel/next.js/pull/71673 hasn’t been added to the release yet,
expected to be at.15.0.1-canary.4Could you try
v15.0.2-canary.0? Thank you!FYI, here is my development environment:
next dev --turbois working healthy but eithernext devornext buildthrows the same error.I have installed the canary version but still issue not resolved. Here is my package.json screenshot with error.
cmd is
Hey everyone, sorry for letting this slip. Feel free to ping me if 15.0.1-canary.2 did not fix it. When we can confirm, will have the patch ASAP to unblock your upgrade. Again, apologies for inconvenience and thank you all for your report. Thank you!
I think we should not inline the path into the string, or we should replace
\with\\on windows. cc @devjiwonchoi