Software⏱️ 2 min read📅 2026-05-30

How to Fix: npm run build not working for the specific Next.js project

Error EPERM operation not permitted scandir C:\Users\LENOVO\Application Data

Quick Answer: Try running npm run build with elevated privileges or in a different directory where the Application Data folder is not located.

To resolve the issue of 'npm run build not working' in a specific Next.js project, first identify the cause of the error. The glob error indicates that there's an issue with accessing certain directories.

🛠️ Step-by-Step Verified Fixes

Method 1: Changing Directory Permissions

  1. Step 1: Open the Command Prompt or PowerShell as an administrator.
  2. Step 2: Navigate to the project directory using the command 'cd '.
  3. Step 3: Run the command 'npm rebuild' in the terminal.

Method 2: Using a Different Build Command

  1. Step 1: Check the 'package.json' file for any custom build commands.
  2. Step 2: If a custom command exists, try running it with the '--build' flag, e.g., 'npm run --build'.

💡 Conclusion

By following these steps and identifying the root cause of the error, you should be able to resolve the issue and successfully run 'npm run build' in your Next.js project.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions