SwethaG
SwethaG

Reputation: 173

Failed to start Watchman watch mode

I am developing a React Native app. My code is error free, but it is facing build problems. I get an error in the Metro Bundler when I execute the command react-native run-android. The error says:

UnhandledPromiseRejectionWarning: Failed to start watch mode.

I also tried adding Watchman to node_modules using the command $yarn add watchman. I get a prompt that it is deprecated.

How should I solve the error?

My package.json contains the following:

"dependencies": {
    "expo": "^25.0.0",
    "native-base": "^2.3.7",
    "react": "16.2.0",
    "react-native": "0.52.0",
    "react-native-vector-icons": "^4.5.0",
    "react-navigation": "^1.0.0-beta.27",
    "watchman": "^1.0.0"
}

"devDependencies": {
    "babel-jest": "22.1.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.1.3",
    "react-test-renderer": "16.2.0"
  }

Upvotes: 3

Views: 17976

Answers (8)

Akila Kavinda
Akila Kavinda

Reputation: 11

Try closing all the opened terminals in vs code or in windows and try running again.

Upvotes: 0

mahesh Alakunta
mahesh Alakunta

Reputation: 1

same issue I got on metro Android

I tried the following Steps:-

1.npx react-native start --reset-cache
2.cd android && ./gradlew clean && cd..
3.npx react-native run-android

In mac, I used
watchman watch-del-all on Terminal
then I re-run the XCode. It's working

Upvotes: 0

Rahul Dasgupta
Rahul Dasgupta

Reputation: 809

I tried the following:

  1. Restarting my system
  2. Deleting npm/yarn cache.

Most of the times the above methods worked but not always. So, here's one-time permanent solution (for Windows)

  1. Download the Watchman v2021.01.11
  2. Unzip, Rename the folder "Watchman" and paste the C:/Program Files.
  3. Open the folder and copy the location of bin folder (would be C:/Program Files/Watchman/bin)
  4. Go to Environment variables, search of PATH variable and append the copied location of bin

Upvotes: 0

varri divya
varri divya

Reputation: 41

I have also faced the same issue.Then I have

  1. Deleted the node modules and installed them again by using npm install.
  2. Then clean gradle by '.\gradlew'
  3. Then run the app by 'npx react-native run-android'.

The above steps helped me to resolve the error.

Upvotes: 3

art_cs
art_cs

Reputation: 791

in windows npm install watchman

Upvotes: 0

lak singh
lak singh

Reputation: 11

Failed to start Watchman watch mode (Windows)

I tried a lot to fixed the issue and at last, I restart my windows now it's working.

Upvotes: -1

SwethaG
SwethaG

Reputation: 173

To have watchman in windows do the following:
(1)Download watchman zip file from the link here
(2) Unzip the folder
(3) Place the watchman.exe file in the folder that is registered in the PATH (environment variable) (Eg: Place the watchman.exe file in C:/ProgramFiles/ and make sure the PATH = 'C:/ProgramFiles')

Done! You would never face this error again!

Upvotes: 9

Michal
Michal

Reputation: 5220

You have to install watchman using brew:

brew install watchman

Upvotes: 1

Related Questions