How to use watchman in MacOS - react-native

I already uninstalled watchman using:
brew uninstall watchman
But when I type watchman in the cmd I still get:
2023-01-06T20:49:27,810: [] while computing sockname: failed to create /opt/local/var/run/watchman/renatoperes-state: No such file or directory
I noticed that actually when I install watchman on by brew uninstall watchman the system is adding the lib in
/usr/local/var/run/watchman/
Does anyone have a clue? Thanks!

Still no progress with installation using brew (even reinstalled Homebrew).
However this seems to work (it's based on watchman formula):
cd /usr/local/var/run
sudo mkdir watchman
sudo chmod 042777 watchman
The watchman version correctly returns the version now:
{
"version": "4.9.0"
}
And it seems to hot reload code in React Native.

Related

How to fix Something went wrong installing the "sharp" module and Cannot find module '../build/Release/sharp.node' in expo

I tried to install expo after I executed the command exp start but I got:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'.
How can I fix this problem?
I had the same problem and this single line command did the trick.
npm rebuild --verbose sharp
Consult the installation documentation at Common problems.
Find the latest version of sharp and install it.
npm install sharp#0.28.3 --save
This worked for me.
I am not using expo but faced this issue in react native.
All I did is "deleted node_modules/sharp" folder.
run npm install.
fixed the issue.
Maybe you configured npm to ignore installation scripts. In that case delete the sharp module and run:
npm install --ignore-scripts=false
This causes after i updated, npm,angular version.
just try
npm i cordova-res
it solves above problem.
I was facing same issue in mac when I update my developer tools using xcode-select install then node project stop working on local
sudo rm -rf /usr/local/Cellar/python3.8
sudo rm -rf /usr/local/Cellar/python3.9
rm yarn.lock
rm package-lock.json
rm -rf node_modules
brew upgrade
yarn install
worked for me
If anyone has this problem and other solutions didn't solve it. Try to uninstall vips globally, it worked for me.
npm -g uninstall libvips
brew uninstall vips
Then:
yarn clean
yarn install
gatsby develop
if trying some quick command fixes don't work you can try rebuilding the node_modules.
Delete the whole node_modules folder and run npm install
npm install
Upgrading of gatsby-transformer-sharp helped me in my case.
You may need to completely reinstall expo-cli package.
yarn global remove expo-cli
yarn global add expo-cli
OR
npm uninstall expo-cli -g
npm install expo-cli -g
(If you don't have expo-cli installed globally, remove global / -f flags)

Unable to resolve module `buffer` from react-native-ssdp

I am facing unable to resolve module 'buffer' from react-native-ssdp.Any one knows how to fix this issue. React native version
react-native-cli: 2.0.1
react-native: 0.58.5/0.59.8
I have tried
1. Clear watchman watches: watchman watch-del-all.
2. Delete the node_modules folder: rm -rf node_modules && npm install.
3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
So, after digging into the component, I found that buffer and other components required by the package are under the peer dependency section of the package.json file.
This means they will not be installed locally for the package, but rather depend on what is installed in your main package.
The quickest fix was installing these packages which are required by the package.
Note that there are several such packages out there that have probably the same exact code such as react-native-ssdp, react-native-ssdp-grok and react-native-upnp.
The same solution will work for any of them.
Install these:
react-native-udp, buffer, and react-native-network-info.
Check the module's package.json for the specific requirements.

Cannot start react-native server

I have React-native project. When I want to start it, I run npm start or yarn start, and I get this:
$ yarn startyarn run v1.7.0
$ react-native-scripts start
11:36:37: Starting packager...
***ERROR STARTING PACKAGER***
No issue with doctor-watchman-version
No issue with doctor-problem-checking-watchman-version
No issue with doctor-both-app-and-exp-json
No issue with doctor-schema-validation
No issue with doctor-validate-asset-fields
No issue with doctor-schema-validation-exception
No issue with doctor-unversioned
No issue with doctor-versions-endpoint-failed
No issue with doctor-invalid-sdk-version
No issue with doctor-node-modules-missing
No issue with doctor-react-native-not-installed
Starting Metro Bundler on port 19001.
Metro Bundler ready.
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: too many pending cache jobs. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
If I uninstall wathcman Packeger get stucked.
Creating .watchmanconfig file, also didn't help.
(Linux Mint OS)
Hours of searching. I have not found a solution yet :(
Try this:
npm r -g watchman
brew update && brew upgrade
brew install watchman
watchman shutdown-server
This command from this GitHub issue worked for me
Try this:
$ npm install
If you are using visual studio, in the bottom of the view there is button to restart. click that and run

Why does "yarn install" raise an ENOENT error when installing esparse?

I have a JavaScript project using npm to manage its dependencies. I'm trying to migrate to Yarn.
When I run yarn install in the console, it gives me an error:
An unexpected error occurred: "ENOENT: no such file or directory,
chmod C:\....\node_modules\.bin\esparse"
From what I read on the yarn docs, just running yarn install should be enough. Why doesn't this work as expected?
I am using Yarn 0.17.0, npm 2.14.12 and Node 4.2.4.
The following Solution worked for me
rm -rf node_modules **/node_modules
rm -rf yarn.lock **/yarn.lock
yarn cache clean
yarn install
This is a pretty old question, but with latest yarn for now (1.17.3) the same problem arises.
The solution which works for me, although more time consuming, is to delete yarn.lock file.
Please keep in mind that afterward, all libraries will get updated to the latest versions according to the rules you specified in package.json file
I had a similar issue which was resolved by running the following commands:
npm install yarn -g --force
yarn --c
rm package-lock.json
rm yarn-lock.json
yarn install

Facebook watchman everytime looses connection on ubuntu 16.04

Facebook watchman everytime looses connection on ubuntu 16.04. Also it gives error "Error: Watcher took too long to load (WatchmanWatcher)". How can I uninstall watchman on ubuntu?
Run these commands:
$ watchman watch-del-all
$ watchman watch-project /path/to/your/project/dir
and try to run it again.
Explanation
With this command
$ watchman watch-list
{
"version": "4.7.0",
"roots": [
"~/path/one"
"~/path/two"
"~/path/three"
"~/path/four"
]
}
you get all the paths that are watched by watchman. If there are too many paths (see roots), watchman takes too long to crawl all the files.
To delete all the paths, run this command:
$ watchman watch-del-all
To add the new project directories to crawl, add project dir with this command:
$ watchman watch-project ~/path/to/project/dir
Since you have deleted all the unnecessary folders, now the react packages should take less time to crawl and build.
Hope this helps someone.