next.js build error #168135
Replies: 8 comments 2 replies
-
create a Then you can add this to your next.config.js Run with no-cache and it should resolve your issue. |
Beta Was this translation helpful? Give feedback.
-
This is a Windows permissions issue where Next.js is trying to scan restricted system directories. Here are several solutions: Quick Fixes (Try These First)• Run as Administrator - Right-click Command Prompt/PowerShell → "Run as administrator", then navigate to your project and run • Check Node.js permissions - Reinstall Node.js as administrator or use a Node version manager like • Clear caches - Run Project-Level Solutions• Add .nextignore - Create
• Update next.config.js - Add webpack ignore patterns: /** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
config.watchOptions = {
...config.watchOptions,
ignored: [
'**/node_modules/**',
'**/Application Data/**',
'**/AppData/**'
]
}
return config
}
}
module.exports = nextConfig System-Level Solutions• Move project location - Avoid paths near system directories, use • Check antivirus - Temporarily disable real-time scanning or add project folder to exclusions • Windows Defender exclusion - Add your development folder to Windows Defender exclusions • Use WSL2 - Install Windows Subsystem for Linux and run your Next.js project there Environment Solutions• Use Docker - Containerize your build process to avoid Windows permission issues • Try different terminal - Use Git Bash, VS Code integrated terminal, or Windows Terminal The issue is Next.js trying to scan |
Beta Was this translation helpful? Give feedback.
-
🧰 Fix Steps Right-click → "Run as administrator" Then navigate to your project folder: bash Create a .nextignore file in your project root with: javascript js module.exports = nextConfig; bash |
Beta Was this translation helpful? Give feedback.
-
if you host in vercel |
Beta Was this translation helpful? Give feedback.
-
Hey there! This is a classic permissions error (EPERM) that often happens when a program can't read or write to a folder it needs to. The path Application Data is a protected system directory, which is likely the root of the problem. Even with admin privileges, some processes can still be blocked. This looks like a common permission issue. The Running as an administrator doesn't always solve these kinds of problems, as another process or a temporary file lock might be the cause. I suggest you try the following steps to fix it:
This usually fixes permission-related build errors. Let me know if that works for you! |
Beta Was this translation helpful? Give feedback.
-
I had the same issue, and I was able to fix it by moving the project to the C: drive, deleting the .next and node_modules folders, and then reinstalling the packages. Reference: vercel/next.js#62281 (comment) |
Beta Was this translation helpful? Give feedback.
-
This error usually happens when a dependency or plugin tries to scan a directory like 🔧 Try these steps:
|
Beta Was this translation helpful? Give feedback.
-
I hope this will work as i got the same issue and it worked in mine 🛠 Step 1: Create
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Hey everyone, I am getting this build error:
I already tried running that in Administrator in PowerShell inside
D:/react/next-project
I am not using webpack or
tailwind.config.json
anyone knows how to solve this ?
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions