I created an issue with Facebook/react-native a couple of days ago, but I have yet to receive a response. In order to try to get me up and running I'm going to ask here as well. issue link
I checked other SO posts concerning this matter and none of the suggestions helped.
I'm following the getting started documentation for Mac/iOS to create the AwesomeProject sample application. When I start the project using
npx react-native start
and build the iOS application in Xcode, the app launches (in the simulator) to show a white splash screen with "Loading from Metro..." at the top. After about a minute, I get the following error:
Could not connect to development server.
Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
- WiFi is enabled and connected to the same network as the Node Server
URL: http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.AwesomeProject
In the terminal where I started the server, I see:
2021-11-13T16:46:53,199: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/chrisluxoft-state/sock! (No such file or directory)
Watchman: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2021-11-13T16:46:53,199: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/chrisluxoft-state/sock! (No such file or directory)
I navigated to
/usr/local/var/run/watchman/chrisluxoft-state/
and there were no files in the directory.
I ran
watchman --foreground --logfile=[pathtodesktop]/log.txt
as suggested here, which produced the following log:
2021-11-13T16:49:35,574: [listener] Watchman 2021.11.08.00 <no build info set> starting up on Grey-Mac.local
2021-11-13T16:49:35,581: [listener] file limit is 2560 kern.maxfilesperproc=49152
2021-11-13T16:49:35,581: [listener] raised file limit to 49152
2021-11-13T16:49:35,581: [listener] launchd checkin failed: No such process
2021-11-13T16:49:35,582: [sanitychecks] starting sanityCheckThread
When I went back to
/usr/local/var/run/watchman/chrisluxoft-state/
I see that there are now two files: pid & sock=
Encouraged by this, I restart the process and rebuild the app in Xcode. Same results, only this time the error in terminal is:
2021-11-13T16:56:49,310: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/chrisluxoft-state/sock! (Connection refused)
Watchman: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2021-11-13T16:56:49,310: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/chrisluxoft-state/sock! (Connection refused)
Again looking at
/usr/local/var/run/watchman/chrisluxoft-state/
I see the same two files. I'm expecting there to be a log file, but it is not there.
This is on a Mac with multiple user accounts, if that makes a difference (i.e. permissions).
node, react-native, watchman were installed by Homebrew. I used the same user account for installation and execution.
react-native info
System:
OS: macOS 11.6.1
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 1.65 GB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 17.0.1 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.1.0 - /usr/local/bin/npm
Watchman: 2021.11.08.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /Volumes/WD_Internal/chrisluxoft/.rvm/gems/ruby-2.7.4/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7784292
Xcode: 13.0/13A233 - /usr/bin/xcodebuild
Languages:
Java: 11.0.12 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.3 => 0.66.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
npx react-native run-ios
from the command line, which will start an instance of Metro and load the app onto the device of your choice. Building from the command line is the more widely used option - I usually only build in Xcode if I am doing iOS-specific stuff. – Hollandianpx react-native start
and got the same connection refused error. As far as I can tell, there are no other instances of Metro running. Same result running the command linenpx react-native run-ios
– Effectivewatchman --foreground
, but why do I have to keep it running? – Bias