Home > Article > Web Front-end > What should I do if react-native cannot run?
Solution to the problem that react-native cannot run: 1. Open the terminal, cd to the project folder, and then enter "npm install jpush-react-native jcore-react-native --save"; 2. Save the project Delete the "node_modules" folder inside; 3. Close the process corresponding to port 8081 and re-run the project.
The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.
What should I do if react-native cannot run?
Pitfalls encountered when running react-native projects
I recently took over a react-native project. When running it with xcode, there are various pitfalls. This error is reported, now take the time to sort it out
1. The header file RCTJPushModule.h cannot be found
I reported this error as soon as I started, read some information to find a solution
Open the terminal , cd to the project folder, enter
npm install jpush-react-native jcore-react-native --save
2. "RCTBundleURLProvider.h" file not found
Then it starts to report that the file cannot be found, read some information to find the solution
Open the terminal and enter the folder directory where the project is located; delete the node_modules folder in the project, and then execute the npm install command; after the npm install installation is completed, execute the react-native upgrade command. Finally, reopen Xcode and clean it.
3.shell Script invocation Error ,Command /bin/sh failed with exit code 2
Port 8081 already in use, packager is either not running or not running correctly
This error occurs again, it will crash, don’t worry, find a solution
This error occurs when running react_native. Solution
Turn off the process corresponding to port 8081. Open the terminal and enter lsof -i:8081
The following picture will appear
Kill process 28181:
kill 28181
Rerun the project
4. Do you think this is enough? No, "Installation Failed Invalid argument" error
The reason is that "Bundle indentifier is set to empty", just fill in the Bundle indentifier
5. Followed by the error in the picture below
Open the terminal cd to the project folder npm install && react-native link
That’s it. There are still some minor problems, which are not listed one by one.
Recommended learning: "react video tutorial"
The above is the detailed content of What should I do if react-native cannot run?. For more information, please follow other related articles on the PHP Chinese website!