Skip to main content

React Native & Windows 10: "EPERM: operation not permitted, lstat"

I'm working on the Android version of a React Native (v0.43.4) app on my Windows 10 machine, which has turned out to be a real pain compared to working on the iOS version on my Mac. I've got everything set up with Android Studio, platform tools, the Android emulator and so on. Running my app in the emulator also works, but almost every single time I issue the react-native run-android command, it fails with the following error from the React Packager:

EPERM: operation not permitted, lstat <some_path_here>

I have no idea what this problem is or why it happens. I don't even have to make any changes to the code or included libraries for it to appear. It's enough to just stop the React Packager and run react-native run-android again to get the error. It's really starting to get on my nerves since rebuilding seems to be required a lot more often on Windows than what I'm used to on OS X.

I'd love to know what causes this, but until I manage to figure that out I've found two workarounds.

Workaround 1:
  1. cd into <APP DIR>/android and run ./gradlew clean
  2. Execute react-native run-android
Seems to work every time but takes forever since everything must be rebuilt after the clean. Which leads us to

Workaround 2:
  1. Execute react-native run-android
  2. As soon as React Packager opens, close it
  3. Wait for react-native run-android to complete giving you the BUILD SUCCESSFUL message.
  4. Then run react-native start to start the React Packager
  5. Reload the emulator (Double tap the R key)
This workaround is usually faster than the clean/rebuild way for me, so while eagerly waiting for a permanent fix to this problem I'll just stick to workaround 2 as long as it does the trick.

Comments

Post a Comment