🚫 Fixing "Permission Denied" and Missing Android Folder Issues in React Native on macOS (M1)
📅 June 2025
👨‍💻 By Rahul Pahuja

🚫 Fixing "Permission Denied" and Missing Android Folder Issues in React Native on macOS (M1) 📅 June 2025 👨💻 By Rahul Pahuja

Here’s a polished LinkedIn article tailored for a global tech audience that details the React Native Android run issue and its solution, optimized with technical clarity and professional tone:


🚫 Fixing "Permission Denied" and Missing Android Folder Issues in React Native on macOS (M1)

📅 June 2025 👨💻 By Rahul Pahuja


🧩 The Problem

While setting up a React Native project targeting Android on my macOS (M1 chip) machine, I ran into two frustrating errors when running:

npx react-native run-android        

❌ Error 1: Permission Denied

EACCES: permission denied, mkdir '/node_modules/.generated'        

❌ Error 2: Android Project Not Found

Android project not found. Are you sure this is a React Native project?        

If you’re a mobile developer juggling Android builds on macOS (especially with M1), this probably looks familiar. Let's fix it step-by-step.


✅ The Solution

🛠 Step 1: Reset Permissions on Node Modules

Never use sudo to run your React Native commands. Instead, reset ownership safely:

sudo chown -R $USER node_modules
sudo rm -rf node_modules
sudo npm install        

This fixes permission issues for .generated and other internal folders created by Metro or CLI tools.


🛠 Step 2: Check if You're Using Expo or Not

Run:

ls -l        

👉 If you don’t see an android/ folder, you are either:

  • Using Expo, which doesn’t generate native folders by default, or
  • Accidentally deleted the android/ directory


📦 For Expo Projects

If you initialized the app with:

npx create-expo-app        

Then, instead of npx react-native run-android, run:

npx expo start        

And press a to launch it on an Android emulator.

Want to use native code? Run:

npx expo prebuild        

This will generate the missing android/ and ios/ directories so you can run native builds.


🛠 Step 3: For Pure React Native Projects

If you're not using Expo, and you somehow lost the Android folder:

📦 Reinitialize the app:

npx react-native init MyApp        

Or manually re-add the missing android/ directory from a fresh template.


💡 Pro Tips for M1 Mac Users

  • Install all required Android SDK tools via Android Studio.
  • Make sure your emulator runs on arm64 images for M1.
  • Avoid using sudo unless you're explicitly fixing a permission issue.


🚀 Final Thoughts

React Native is powerful, but environment setup—especially on M1 Macs—can sometimes get messy. Understanding the difference between Expo and Vanilla React Native, and respecting the permissions model of macOS, goes a long way.

🔧 With just a few simple steps, I was able to fix both issues and run the Android app successfully.

If this helped, feel free to connect. Let’s keep building! 💪


#ReactNative #AndroidDevelopment #Expo #MacOSM1 #MobileDevelopment #TechFixes #RahulPahuja

To view or add a comment, sign in

Others also viewed

Explore topics