Watchman on my Mac is not working ? (React Native) - react-native

This is my first time using a Mac for react native dev so I installed
everything and made a project but when I try to run (npm run start) it gives
me an error. Thanks for the help if you can :)
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/struanmclean/Documents/Dovekie/App: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.
/Users/struanmclean/Documents/Dovekie/App/node_modules/metro-hermes-compiler/src/emhermesc.js:77
throw ex;
^
Error: std::__1::system_error: open: /Users/struanmclean/Documents/Dovekie/App: Operation not permitted
at BunserBuf. (/Users/struanmclean/Documents/Dovekie/App/node_modules/fb-watchman/index.js:95:23)
at BunserBuf.emit (node:events:527:28)
at BunserBuf.process (/Users/struanmclean/Documents/Dovekie/App/node_modules/bser/index.js:292:10)
at /Users/struanmclean/Documents/Dovekie/App/node_modules/bser/index.js:247:12
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Emitted 'error' event on WatchmanWatcher instance at:
at Client. (/Users/struanmclean/Documents/Dovekie/App/node_modules/metro/node_modules/jest-haste-map/build/watchers/WatchmanWatcher.js:150:10)
at Client.emit (node:events:527:28)
at BunserBuf. (/Users/struanmclean/Documents/Dovekie/App/node_modules/fb-watchman/index.js:107:12)
at BunserBuf.emit (node:events:527:28)
at /Users/struanmclean/Documents/Dovekie/App/node_modules/bser/index.js:249:12
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
watchmanResponse: {
error: 'std::__1::system_error: open: /Users/struanmclean/Documents/Dovekie/App: Operation not permitted',
version: '2022.06.13.00'
}
}

Related

Astro initialize project Error: ENOTEMPTY: directory not empty

it was okay 2 days ago, i installed almost anything on brew, whenever i do create astro it sent me the same error in any package manager
node:fs:1213
return handleErrorFromBinding(ctx);
^
Error: ENOTEMPTY: directory not empty, rmdir 'p22'
at Object.rmdirSync (node:fs:1213:10)
at copyTemplate (file:///Users/rezaarya4/.npm/_npx/a3f2c23699a1336a/node_modules/create-astro/dist/index.js:767:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -66,
syscall: 'rmdir',
code: 'ENOTEMPTY',
path: 'p22'
}
for now i did complete renstall node from brew, deleting all node modules in all package manager folders, using nvm, and restarting my mac, i'm afraid my Mac one's causing it, or there's a corrupt node module causing this? sorry i'm new to this

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.

react native init failed

whenever I create a new project then it throws the following Error. I did update any settings. everything was working fine before yesterday. Here is my issue.
[1/4] Resolving packages...
error Couldn't find package **"#typescript-eslint/parser#^4.22.1"** required by **"#react-native-community/eslint-config"** on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
E:\example\project\node_modules\execa\index.js:174
err = new Error(`Command failed: ${joinedCmd}${output}`);
^
Error: Command failed: yarn add -D #babel/core #babel/runtime #react-native-community/eslint-config eslint jest babel-jest metro-react-native-babel-preset react-test-renderer#17.0.1
at makeError (E:\example\project\node_modules\execa\index.js:174:9)
at E:\example\project\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async generateProject (E:\example\project\node_modules\#react-native-community\cli\build\commands\init\initCompat.js:128:3)
at async Object.initCompat (E:\example\project\node_modules\#react-native-community\cli\build\commands\init\initCompat.js:105:3) {
code: 1,
stdout: null,
stderr: null,
failed: true,
signal: null,
cmd: 'yarn add -D #babel/core #babel/runtime #react-native-community/eslint-config eslint jest babel-jest metro-react-native-babel-preset react-test-renderer#17.0.1',
timedOut: false,
killed: false
}
I did all remove a node, update node, removed react-native-CLI, and update it and it was fixed for some time. but I was unable to install any package.
it's now day 2 and I am stuck here.
before running react-native init try running npm install #typescript-eslint/parser#^4.22.1 I hope it resolves the issue.
if the issue persists try clearing cache with:
npm cache clean --force
Finally after search for a long time. I found a solution. just go to the network setting and turn off automatic proxy setting detection.

Error running react-native start on project after expo eject

I just ejected my project from Expo using expo eject, and when I try to run it using react-native start, I get the following error message in my Terminal:
events.js:287
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (/usr/local/lib/node_modules/react-native/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (events.js:310:20)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
I can't make out what I need to know to resolve this issue, so can someone point out the proper steps I should take to get my project running on react-native? Thanks!
Run the following in your command line to install watchman:
brew update
brew install watchman
try installing watchman - this improves on file watching capabilities of the react native packager server. see: https://facebook.github.io/watchman/

react-native init gives ESOCKETTIMEDOUT error

I am using a Macbook and when I try to create a React Native app, it throws ESOCKETTIMEDOUT error.
I have tried to clean the npm and yarn cache however it doesn't help.
react-native init AwesomeProject
This will walk you through creating a new React Native project in /Users/gaurang.shah/Documents/personal/code/mobile/AwesomeProject
Using yarn v1.13.0
Installing react-native...
yarn add v1.13.0
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/gaurang.shah/Documents/personal/code/mobile/AwesomeProject/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
I am able to download the https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz file through my browser, so it can't be networking issue.
Stacktrace
Yarn version:
1.13.0
Node version:
11.10.0
Platform:
darwin x64
Trace:
Error: https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz: ESOCKETTIMEDOUT
at ClientRequest.<anonymous> (/usr/local/Cellar/yarn/1.13.0/libexec/lib/cli.js:130024:19)
at Object.onceWrapper (events.js:285:13)
at ClientRequest.emit (events.js:197:13)
at TLSSocket.emitRequestTimeout (_http_client.js:669:40)
at Object.onceWrapper (events.js:285:13)
at TLSSocket.emit (events.js:197:13)
at TLSSocket.Socket._onTimeout (net.js:447:8)
at listOnTimeout (timers.js:327:15)
at processTimers (timers.js:271:5)
npm manifest:
{"name":"AwesomeProject","version":"0.0.1","private":true,"scripts":{"start":"node node_modules/react-native/local-cli/cli.js start"}}
yarn manifest:
No manifest
Lockfile:
No lockfile
Had the same issue when retrieving big packages on a slow network. As suggested on this comment, increasing the network timeout for installing the packages worked for me.
Firstly, have your project directory created beforehand and then create a .yarnrc file inside of it having the following content:
network-timeout 600000
Now, just run the react-native init <project_name> command from the parent directory of your project as you did.
It is equivalent to running yarn like so:
yarn install --network-timeout 600000
If npm can be used, please use 'npm install' & it generates package-lock.json or 'yarn install --network-timeout <time in ms>' - generates yarn.lock. Both works for me.