I ejected to ExpoKit recently and followed the documentation, however, whenever I tried to run the app on any device or simulator the following error was thrown:
Error: EPERM: operation not permitted, lstat …
I scoured these forums and google in search for an aswer but none were sufficient.
I finally figured out that metro watches the android directory created by ExpoKit and this conflicts when Android Studio is building or cleaning, or anything else that manipulates the files in the android directory.
I figured out that I could make metro skip this directory by adding a metro.config.js file to my project root where I could set resolve.blacklistRE to exlude certain files or directories from the bundler.
I’m leaving this here in the hope it can help others.
My metro.config.js file is as follows:
var getBlacklistRE = function getBlacklistRE(){
return new RegExp("(.*\\android\\.*|.*\\__fixtures__\\.*|node_modules[\\\\]react[\\\\]dist[\\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$");
}
module.exports = {
resolver: {
"blacklistRE": getBlacklistRE(),
}
};