-
Notifications
You must be signed in to change notification settings - Fork 27.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v15] Module parse failed: Bad character escape sequence #71582
Comments
v15 stable has this bug it's CRAZY! Is anyone in the next.js community actually reviewing code? |
Looks like this started appearing in |
What node.js version are you using (please fill out the entire issue template next time)? There was a bug in some recent Node.js versions recently (mainly 22.7.0) that had some similar symptoms, you should try upgrading if you are using that version. |
I think we should not inline the path into the string, or we should replace |
I'm using node verion |
### Why? When handling the `opengraph-image` size exceeding the limit, we mapped with string literal between Rust and JavaScript. The Rust string literal contains backslashes `\` on Windows, incompatible with JavaScript string syntax. Fixes vercel#71582 --------- Co-authored-by: Donny/강동윤 <[email protected]>
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! |
@devjiwonchoi, I suppose to webpack loader should be fix as well:
|
@Sayakie Thank you! @faisalrehmanlums Could you add the |
FYI, here is my development environment: Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 23855
Available CPU cores: 12
Binaries:
Node: 22.9.0
npm: N/A
Yarn: N/A
pnpm: 9.12.0
Relevant Packages:
next: 15.0.1 // Latest available version is detected (15.0.1).
eslint-config-next: 14.2.13
react: 19.0.0-rc-45804af1-20241021
react-dom: 19.0.0-rc-45804af1-20241021
typescript: 5.6.2
Next.js Config:
output: N/A
|
) ### Why? When handling the opengraph-image size exceeding the limit, we mapped with string literal between Rust and JavaScript. The Rust string literal contains backslashes `\` on Windows, incompatible with JavaScript string syntax. Following up on vercel#71615. Fixes vercel#71582
@faisalrehmanlums Hi, #71673 hasn't been added to the release yet, Could you try |
I just tried this, not working. |
I get this issue when I run dev or build. If you run dev you gotta load a page to see the bug propagate |
@dualdetail @Rakvadium @faisalrehmanlums Since I cannot reproduce the case, it isn't easy to fix it confidently. CleanShot.2024-10-25.at.05.02.32.mp4
|
The npx create next app works and I was also able to get the turbo repo basic example updated and working. Let me try to work and see if I can figure out whats going on. I don't understand why it's breaking on my mono repo but not others just yet |
|
@dualdetail Could you try removing |
I deleted favicon.ico and it returned to normal operation. |
I am pretty confused, I can only get the icons to work using the --turbo flag and refactoring a bit. Similar to what Sayakie mentioned a while ago. I did try to remove all node_modules and .next folders and also recloned but both still fail on build. I did notice that the nextjs docs mention turbo not being experimental anymore, but it's still a experimental option in the next.config.ts. If anyone can confirm this then I at least know my package isn't bugged or anything. I think I'll try messing around with my next config to see if maybe the error lies there. |
This is also what "fixed" it for me. Should definitely not run into that error for having a favicon.ico file... |
Sure, confirm also I deleted favicon.ico and worked again. |
I've been going crazy, but I just decided to mess with the dist that I have (15.0.2-canary.7) and I just modified the code and got it to work properly. I had to run a replaceAll on the resource path to adjust any \ to \\ (what kdy1 mentioned earlier) which fixed my problems. For whatever reason the path.default.posix.normalize(resourcePath) does not fix the path for me at all (I'm using Windows 11 pro). I'm not sure why normalize doesn't do jack, but the printed path is the same as what comes in originally. |
SolutionI have a very similar issue but the error message is I found the solution while playing with the dist file (./node_modules/next/dist/build/webpack/loaders/next-metadata-route-loader.js). throw new Error('File size for ${imgName} image "${JSON.stringify(resourcePath)}" exceeds ${fileSizeLimit}MB. ' +
\`(Current: \${fileSizeInMB.toFixed(2)}MB)\n\` +
'Read more: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#image-files-jpg-png-gif'
)
throw new Error('Default export is missing in ${JSON.stringify(resourcePath)}') About the errorWhat I found about the error :
Reproducing the errorHow I got the error :
No error in these cases :
Hope this helps ;) |
Could you guys all try the |
Hey everyone, v15.0.2 is out with the fix. Please give it a try and lmk! |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/condescending-haze-go8s7s
To Reproduce
npx create-next-app@latest
"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" }
| 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
The text was updated successfully, but these errors were encountered: