Every time, after a pull, I run.
git init
git pull
npm i or npm install
In the first time all pages working as I wish. But when changing from one page to another in localhost - I get this error:
missing required error components, refreshing...
In my console, I have something like that:
⨯ Error: ENOENT: no such file or directory, open '/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/.next/server/pages/api/external/news-api.js'
at Object.readFileUtf8 (/Users/jonasoliveira/.vscode/extensions/wallabyjs.console-ninja-1.0.266/out/buildHook/index.js:1144:66509)
at Object.readFileUtf8 (node:internal/fs/sync:25:18)
at Object.readFileSync (node:fs:441:19)
at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at mod.require (/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/node_modules/next/dist/server/require-hook.js:64:28)
at require (node:internal/modules/helpers:130:18)
at NodeModuleLoader.load (/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/node_modules/next/dist/server/future/helpers/module-loader/node-module-loader.js:15:84)
at RouteModuleLoader.load (/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/node_modules/next/dist/server/future/helpers/module-loader/route-module-loader.js:14:37)
at DevServer.runApi (/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/node_modules/next/dist/server/next-server.js:543:67)
at DevServer.handleApiRequest (/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/node_modules/next/dist/server/next-server.js:725:21)
at NextNodeServer.handleCatchallRenderRequest (/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/node_modules/next/dist/server/next-server.js:263:48)
at async DevServer.handleRequestImpl (/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/node_modules/next/dist/server/base-server.js:798:17) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/jonasoliveira/Documents/Documentos - MacBook Pro de Jonas/next/sala-two/.next/server/pages/api/external/news-api.js'
}
The page is not missing, the error does not represent reality, and missing page changes every time that I have this issue.
I don't know what to do anymore.
happened to me when i had 2 instance of the same app running by accident
In my case, I just upgraded to NextJS 14.1 and I started getting this error.
If you have 'output' and 'distDir' in your next.config.js you will get this error on the dev server
{
output: 'export',
distDir: 'build',
}
Removing the distDir will solve this issue
I reported this https://github.com/vercel/next.js/issues/61905
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With