Problem with React Native : watchman warning - react-native

watchman warning:
opendir(/Users/mahamadouniakate/Library/Caches/CloudKit/com.apple.Safari) -> Operation not permitted. Marking this portion of the tree deleted
To clear this warning, run:
`watchman watch-del /Users/mahamadouniakate ; watchman watch-project /Users/mahamadouniakate`
INFO
03:35
Opening exp://127.0.0.1:19000 in iOS simulator
ERROR
03:35
opendir(/Users/mahamadouniakate/Library/Caches/CloudKit/com.apple.Safari) -> Operation not permitted. Marking this portion of the tree deleted
To clear this warning, run:
`watchman watch-del /Users/mahamadouniakate ; watchman watch-project /Users/mahamadouniakate`
ERROR
03:35
opendir(/Users/mahamadouniakate/Library/Caches/CloudKit/com.apple.Safari) -> Operation not permitted. Marking this portion of the tree deleted
To clear this warning, run:
`watchman watch-del /Users/mahamadouniakate ; watchman watch-project /Users/mahamadouniakate`
INFO
03:35
Tunnel ready.
ERROR
04:42
We noticed your tunnel is having issues. This may be due to intermittent problems with our tunnel provider. If you have trouble connecting to your app, try to Restart the project, or switch Host to LAN.
INFO

In my case it was because I had two directories called 'watchman', I don't know why this happened, just uncheck the repeated boxes in
Mac-> System Preferences -> Security and privacy -> Privacy

For me this solution works:
Run these commands one by one -
$ watchman watch-del-all
$ watchman shutdown-server

Related

Watchman Version Showing 0.0.0. Preventing npm start on React Native App

I am trying to develop a react native application on MacOS, but I have been running into issues with installing watchman onto the machine. I have been running the command brew install watchman and whenever I enter the command watchman version the output displays version: 0.0.0. However, directly after running the first installation command over again, I see Warning: watchman 2022.06.06.00 is already installed and up-to-date which is really confusing me.
I have tried various different troubleshooting techniques such as uninstalling and reinstalling watchman, instead of using brew I attempted using sudo port install watchman with MacPorts, removing the .watchmanconfig file and re-creating it, and lastly restarting my device, but none of these solutions have seemed to work for me.
Whenever, I open my react native project and run the command npm start, this is the output that I see,
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
...
watchmanResponse: {
error: 'std::__1::system_error: open: /Users/USER/Desktop/ReactNativeApp: Operation not permitted',
version: '0.0.0'
}
This error message ends the npm start and because of this, I am unable to run npm run ios and continue with the development of the application. If anyone happens to know of any fixes or has experienced this before I would appreciate it if you share how I can resolve it. Thank you.
We can resolved this when we put our project outside from those folder Desktop,Download and Document
then run
npm start
It will be work
thanks

Having an Watchman Issue React native

To reload the app press "r"
To open developer menu press "d"
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: std::__1::system_error: open: /Users/abdullahshahid/Documents/caremiles-react-native-repo: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.
/Users/abdullahshahid/Documents/caremiles-react-native-repo/node_modules/metro-hermes-compiler/src/emhermesc.js:77
throw ex;
^
Error: std::__1::system_error: open: /Users/abdullahshahid/Documents/caremiles-react-native-repo: Operation not permitted
at BunserBuf.<anonymous> (/Users/abdullahshahid/Documents/caremiles-react-native-repo/node_modules/fb-watchman/index.js:95:23)
at BunserBuf.emit (node:events:527:28)
at BunserBuf.process (/Users/abdullahshahid/Documents/caremiles-react-native-repo/node_modules/bser/index.js:292:10)
at /Users/abdullahshahid/Documents/caremiles-react-native-repo/node_modules/bser/index.js:247:12
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Emitted 'error' event on WatchmanWatcher instance at:
at Client.<anonymous> (/Users/abdullahshahid/Documents/caremiles-react-native-repo/node_modules/jest-haste-map/build/lib/WatchmanWatcher.js:172:10)
at Client.emit (node:events:527:28)
at BunserBuf.<anonymous> (/Users/abdullahshahid/Documents/caremiles-react-native-repo/node_modules/fb-watchman/index.js:107:12)
at BunserBuf.emit (node:events:527:28)
at /Users/abdullahshahid/Documents/caremiles-react-native-repo/node_modules/bser/index.js:249:12
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
watchmanResponse: {
error: 'std::__1::system_error: open: /Users/abdullahshahid/Documents/caremiles-react-native-repo: Operation not permitted',
version: '2022.05.30.00'
}
}
Node.js v18.2.0
I give permission to watchman and terminal in System Preferences > Security and Privacy Full Disk And also tried watch-del-all command and watchman shutdown-server command but still no success
I have mac os monetery need help ?
run brew uninstall watchman in your terminal should solve it
For macos Monterey you will need to uninstall watchman.
run brew uninstall watchman in your terminal
I had my repo in my Documents folder on my M1 macbook pro. This thread said to move it out of that folder and now it runs great!
One of the answers here mentioned placing the repo under Documents, but that did not work for me. Instead, I placed it under the Users/myuser/ directory and it worked.

YARN START gives no space left on device error

OS : UBUNTU 18.04
I created a simple create-react-app project then fired up a server using yarn start. 30% of the times it works fine but 70% of the times I get the following error.
Starting the development server...
events.js:167
throw er; // Unhandled 'error' event
^
Error: ENOSPC: no space left on device, watch '/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/public'
at FSWatcher.start (internal/fs/watchers.js:164:26)
at Object.watch (fs.js:1232:11)
at createFsWatchInstance (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:232:14)
at FSWatcher.NodeFsHandler._handleDir (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:414:19)
at FSWatcher.<anonymous> (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:462:19)
at FSWatcher.<anonymous> (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:467:16)
at FSReqWrap.oncomplete (fs.js:155:5)
Emitted 'error' event at:
at FSWatcher._handleError (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:39:5)
at setFsWatchListener (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:80:15)
[... lines matching original stack trace ...]
at FSReqWrap.oncomplete (fs.js:155:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm clueless on how this error comes up. I have literally nothing stored on my laptop and around 90% Harddisk is free. The working directory has nearly 200+ GB free space. I also tried starting the project by copying the entire project into different locations(different drives too) but none worked. Also, tried npm start but that too did not work.
Try removing your node_modules folder, then using NPM to install ('npm i') and run ('npm run start'), instead of Yarn.
I received the same error, preventing me from running my Node project using Yarn. I tried Node v10.10.0 and v8.12.0.
Removing my node_modules folder and reinstalling with Yarn did not help.
I had a similar issue. Solved it by increasing the number of inotify watches. using assistance here:
https://github.com/parcel-bundler/parcel/issues/1427
https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers
By using:
sudo sysctl fs.inotify.max_user_watches=999999999
and persisted using:
echo fs.inotify.max_user_watches=999999999 | sudo tee -a /etc/sysctl.conf
sudo sysctl --system
You need to check your Node.js version.
As documentation say You’ll need to have Node >= 6 on your local development machine

Watchman crawl failed. Retrying once with node crawler

Watchman crawl failed. Retrying once with node crawler. Usually this
happens when watchman isn't running. Create an empty .watchmanconfig
file in your project's root folder or initialize a git or hg
repository in your project.
Error: watchman --no-pretty get-sockname
returned with exit code=1, signal=null, stderr=
2018-03-23T11:33:13,360: [0x7fff9755f3c0] the owner of
/usr/local/var/run/watchman/root-state is uid 501 and doesn't match
your euid 0
Testing with jest:
Step 1:
watchman watch-del-all
Step 2:
watchman shutdown-server
You're running watchman as root but the state dir, which may contain trigger definitions and thus allow spawning arbitrary commands, is not owned by root. This is a security issue and thus watchman is refusing to start.
The safest way to resolve this is to remove the state dir by running:
rm -rf /usr/local/var/run/watchman/root-state
I'd recommend that you avoid running tools that wish to use watchman using sudo to avoid this happening again.
As Jodie suggested above I tried the below and it worked well, for the benefit of others mentioning below steps which I tried in my mac to fix this issue
First, Kill all the server running and close your terminal.
Go to 'System preferences' -> 'Security & Privacy' -> privacy tab
Scroll down and click 'Full Disk Access'
Make sure you checked on 'Terminal' and 'Watchman'.
Now relaunch terminal and simply try running again it works!!
-June 8 2022
Giving Full Disk Access to all terminals or where you're getting started your server, is fixed the error.
Also, it would be good to give access (Files and Folders) to VSC.
Here are the steps to do it!
Open System Preferences
Find Security & Privacy option and open it
Give Full Disk Access to your terminals, Xcode and VSC.
Happy Hacking!!!
I had a real issue with this one but finally found the answer.
Here's a screenshot of the post that helped me.
https://github.com/facebook/watchman/issues/751#issuecomment-542300670
The whole forum has multiple different solutions which I hadn't actually tried, but this one is the solution that worked for me! Hope this helps.
watchman watch-del-all && rm -f yarn.lock && rm -rf node_modules && yarn && yarn start -- --reset-cache
I solved this, on linux by using the following commands on terminal.
$ echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
$ echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
$ echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
$ pkill node
Then:
$ npm start
or
$ expo start (if you are using expo)
Step 1: $ npm cache clean --force
Step 2: Delete node_modules: $ rm -rf node_modules
Step 3: npm install
Step 4? (Optional): yarn start / npm start
This worked for me. Hopes it works for you too.
On a Mac, remove all watches and associated triggers of running process, then shutdown the service. See screenshot below:
Put your project in a shared folder (ie, Macintosh HD/Users/Shared. I kept getting operation denied on the Desktop, because of further protection policies, even though Full Disk Access was granted.
To solve this issue on my end, i had to stop the other node instance running on my other terminal. Just make sure you don't have another node running on your machine.
check for .watchmanconfig and add this {}.
Inside the file .watchmanconfig
{}
Simple as that just try it.
Watchman config file
I set my .watchconfig file to be extra permissible:
Add this code to your .watchmanconfig file
{
"ignore_dirs": [],
"fsevents_latency": 0.5,
"fsevents_try_resync": true
}
Use sudo command to run watchman.
sudo npm run test
This problem arose because you might be running watchman as root.

React Native - npm start doesn't start

I'm trying to work with React Native in Fedora 26, and I have followed the facebook tutorial until then.
Everything was going very well, until I try to start the application
with npm
npm start
And receive this error:
> cardbook#0.1.0 start $HOME/cardbook
> react-native-scripts start
9:31:54 AM: Starting packager...
***ERROR STARTING PACKAGER***
Starting React Native packager...
Scanning 770 folders for symlinks in $HOME/cardbook/node_modules (19ms)
Loading dependency graph.
Running packager on port 19001.
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: A non-recoverable condition has triggered. Watchman needs your help!
The triggering condition was at timestamp=1507206724: inotify-add-watch($HOME/cardbook/node_modules/react-native-maps/lib/android/lib/build/tmp/expandedArchives/classes.jar_6745ow7srqaaq6vs8k7dkn33k/com/google/android/gms/common/data) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem. You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
Additional Information:
watchman version: 4.9.0
npm version: 3.10.10
Could any pure and kind-hearted soul help me?
I'm running my application right now on my phone. I followed an heuristic approach, trying to resolve the problem quickly, then there is a great lack of information. Anyway I solved it like that:
First I uninstalled watchman:
$ sudo make uninstall
So with yarn (note that I didn't use npm, which still doesn't work), I received the following tips:
yarn start
yarn run v1.1.0
$ react-native-scripts start
11:15:08 AM: Unable to start server
See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288
error Command failed with exit code 1.
Obviously I followed the instructions:
sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288
And received my QR-code with succes.
Just type following commands to fix it if you don't wanna install Watchman
sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288