React Native - npm start并没有开始

时间:2017-10-05 13:06:27

标签: react-native npm npm-start watchman

我尝试在Fedora 26中使用React Native,直到那时我一直关注facebook tutorial

一切都很顺利,直到我尝试启动应用程序 与npm

  

npm start

并收到此错误:

> 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.

其他信息:

  • 守望者版本:4.9.0
  • npm version:3.10.10

任何纯洁善良的灵魂能帮助我吗?

2 个答案:

答案 0 :(得分:1)

我正在手机上运行我的应用程序。我采用了启发式方法,试图快速解决问题,然后缺乏信息。无论如何,我解决了这个问题:

首先我卸载了守望者:

$ sudo make uninstall

所以对于纱线(注意我没有使用npm,这仍然不起作用),我收到了以下提示:

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.

显然我按照说明操作:

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288

并成功收到了我的QR码。

答案 1 :(得分:0)

如果您不想安装Watchman,只需键入以下命令即可对其进行修复

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288