DEV Community

Sandra Lundgren
Sandra Lundgren

Posted on • Updated on

 

React Native Troubleshooting Tips

This list of tips is a work in progress.

Tip # 1: Metro Bundler errors, such as ENOENT: no such file or directory, uv_cwd
jest-haste-map: watch error

jest-haste-map: watch error:
Error: EISDIR: illegal operation on a directory, read at Object.fs.readSync (fs.js:690:18)...

It's a good idea to keep an eye on the terminal running the Metro Bundler as a lot of errors - in particular bundling and syntax errors - will show up there.

To fix the jest-hast-map or uv_cwd error and most of other problems not syntax-related run the commands

$ killall node
(This command kills all node processes so it's admittedly a bit overkill, the Metro Bundler process is the one you want to kill, and by default the Metro Bundler runs on port 8081)
$ rm -rf ios/build/ && react-native run-ios
Removes the iOS build first and then runs the iOS simulator again.

$ killall node
$ react-native run-ios

Tip # 2 Unrecognized font family 'fontcustom' fix

$ react-native link

You might need to specify the package name to link.

Tip # 3: fix laggy iOS simulator

The React Native iOS simulator can get very slow, so slow that even opening the dev tools menu has a very noticeable lag.
If you are having this problem you should check that "Toggle Slow Animations" is not activated.
In the iOS simulator, click on "Debug" -> "Toggle Slow Animations" should be unchecked.

Tip # 4: fix XCode's 'App installation failed -
The maximum number of apps for free development profiles has been reached.'

Delete some apps that you have installed using the same profile from your device.
Go to "Window -> Devices and Simulators".
Then delete any apps in the INSTALLED APPS section.
Clean the project in XCode by using the SHIFT + cmd + K and try to build the project to iPhone again.

Tip # 5: XCode's shows "No Filter Results" in the project navigator view

Go to "Navigate > Reveal in Project Navigator".

Tip # 6: Fix 99% of weird problems

Delete the app in the simulator.
Close the simulator.
Run all or a combination of the following commands:

$ kill $(lsof -t -i:8081)

Stops the Metro Bundler.

$ rm -rf ios/build/
$ watchman watch-del-all
$ rm -rf node_modules/
$ npm start -- --reset-cache
$ npm install
$ react-native run-ios

**Tip # 7: Fix "“blurTextInput” is deprecated": un-deprecated in v0.58

import { Keyboard } from 'react-native';

<TextInput
...
onBlur={Keyboard.dismiss()}
/>

Correction: it appears that “blurTextInput” was deprecated and then un-deprecated in v0.58. Read more about it on React Native's repo.

** Tip # 8: Unwanted black borders on iPad simulator

In XCode's Project settings, go to the General tab.
Then go to the "Build Settings" tab.
In the search bar, type "Targeted Device Family".
Select "1,2".
Rebuild.

Top comments (0)

Regex for lazy developers

regex for lazy devs

You know who you are. Sorry for the callout 😆