yarn build with Webpack 5 + next-18next fails with Error: ENOENT: no such file or directory
See original GitHub issueWhat version of Next.js are you using?
10.2.0
What version of Node.js are you using?
v14.15.3
What browser are you using?
N/A
What operating system are you using?
macOS + Vercel (Bug appear in both)
How are you deploying your application?
Vercel
Describe the Bug
I tried adding next-i18next on a brand new project.
I followed the installation path described in the repo. and everything was working in dev.
Running yarn build
gives me back:
info - Generating static pages (9/9)
> Build error occurred
[Error: ENOENT: no such file or directory, rename '/Users/denispasin/Projects/index/.next/export/fr.html' -> '/Users/denispasin/Projects/index/.next/server/pages/fr.html'] {
errno: -2,
code: 'ENOENT',
syscall: 'rename',
path: '/Users/denispasin/Projects/index/.next/export/fr.html',
dest: '/Users/denispasin/Projects/index/.next/server/pages/fr.html'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If I deactivate Webpack 5 in next.config.js with:
module.exports = {
future: {
webpack5: false,
},
};
I don’t have the error anymore. Also I have one more supposedly page generated: Generating static pages (10/10)
Expected Behavior
I should not have an error.
To Reproduce
You can clone this repo at the right commit: 496ede5fe23c79e3227da1622155123ccf83e04b.
This commit was basically:
- Follow minimal installation pattern here: https://github.com/isaachinman/next-i18next
- Add a random string a both json to test.
Run yarn build
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
Module build failed: Error: ENOENT: no such file or directory
I just started a new project using React with Webpack. I keep getting the same error when serving the app.
Read more >To v5 from v4 - webpack
Webpack 5 requires at least Node.js 10.13.0 (LTS), so make sure you ... Make sure your build has no errors or warnings ......
Read more >Yarn install throwing errors - sage - Roots Discourse
warning "postcss-html@0.12.0" has incorrect peer dependency "sugarss@>=1.0.0". error An unexpected error occurred: "ENOENT: no such file or directory, open '/ ...
Read more >React Webpack deployment failed: ENOENT: no such file or ...
So I tried to deploy a react app by building it with webpack.Building went well as it as it would locally.However, after a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fyi: https://github.com/isaachinman/next-i18next/pull/1384
Not right now. I’m not on a computer at the moment. Sorry 😅 I’ll try to remember to test that tomorrow.