React Native - npm start doesn't start - react-native

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

Related

running vue documentation locally

i was trying to run vuejs documentation offline (locally) and had no lack, it worked in the past but i don't know what i have done wrong.
i followed the steps on the following post
hear
basically the steps are
install hexo-cli globally
npm install hexo-cli --global
clone vuejs.org repository
git clone https://github.com/vuejs/vuejs.org.git
install project dependencies
cd vuejs.org && npm install
run local server using npm or hexo
npm start
i keep gett
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: watch /vuejs.org/themes/vue/layout/icons/ltc.ejs ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1374:19)
at Object.fs.watch (fs.js:1400:11)
at createFsWatchInstance (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleFile (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:255:21)
at FSWatcher.<anonymous> (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:473:21)
at FSReqWrap.oncomplete (fs.js:153:5)
You ran out of watchers. Proper solution would be to find out why that happened, however you can simply raise available amount of watchers.
fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
or remove files that are watched but aren't needed, for example some unused templates or assets.
You can find more options here:
Node.JS Error: ENOSPC

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

ENOSPC Error in create-react-app

create-react-app error
I get this error message when I run yarn start from my terminal... I've tried sudo killall node and many other process to clear the i-node yet no success.
I have also downgraded my create-react-app version to version 1.5.1 and yet I still have these errors...
Please can anyone help out?
You're most likely hitting the Unix limit of how many files a process can watch.
The following command should help:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
By default linux machine puts some limit on number of programs inotify program can watch/monitor.
On running the react development server, the create-react-app ask the inotify program to monitor more files than its limit. Babel and webpack in the creat-react-app are using chokidar to monitor files which in turn is using inotify program to monitor them, hence this crosses the limit of inotify program.
By running the following command the limit of inotify program is increased and issue is solved.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
i faced the same issue twice...
first time i tried deleting whole node modules using
rm -rf ./node_modules
and installed it again (npm install) and it worked.
BUT, second time it did not.
this time i tried cleaning the unused dependencies from npm modules using,
npm clean-install
and it started the server again.
as it removes the unused dependencies thus decreasing the number of files to watch in a single process.

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.

"yarn start" for React Native app fails with "Unable to start server"

When I execute yarn start within my React Native app project folder I get this error:
yarn run v1.3.2
$ react-native-scripts start
21:58:08: Unable to start server
See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
sudo sysctl -w kern.maxfiles=5242880
sudo sysctl -w kern.maxfilesperproc=524288
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
After I executed the two commands - sudo sysctl -w kern.maxfiles=5242880 and sudo sysctl -w kern.maxfilesperproc=524288 - from the error message yarn start worked liked expected.