Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Describe the bug
I assume this is because I built the app on a Windows env, and deploying to a Linux.
Is there an option somewhere to force slashes during build?
I have just hit this very same issue.
I have run the next build on a windows machine then used the Windows Subsystem for Linux (with an Ubuntu distro) to deploy to a linux box and the build-manifest.json, pages-manifest.json and main-6cc0b499433f56b326b8.js files all needed the double backslashes exchanged for forward slashes for it to work.
I tried to build on windows and deploy that result to AWS beanstalk and got the slashes issue. It probably would be nice to be able to pass in some path character variable override. I used Windows Subsystem for Linux to get around this:
update: next 7.0.0 in WSL is hanging on build now so your workaround is to use some external CI system (I am using AWS CodeBuild)
This PR Fixes #4920 So the problem is that when a next.js application is built on windows, the `pages-manifest.json` file is created with backslashes. If this built application is deployed to a linux hosting enviroment, the server will fail when trying to load the modules. ``` Error: Cannot find module '/user_code/next/server/bundles\pages\index.js ``` My simple solution is to modify the `pages-manifest.json` to always use linux separator (`/`), then also modify `server/require.js` to, when requiring page, replace any separator (`\` or `/`) with current platform-specific file separator (`require('path').sep`). The fix in `server/require.js` would be sufficient, but my opinion is that having some cross-platform consistency is nice. This change was tested by bulding an application in windows and running it in linux and windows, aswell as building an application in linux and running it in linux and windows. The related tests was also run.