[ractNative]watchman 起不来,page loading不出来

本文介绍了解决React Native项目中遇到的Watchman无法启动的问题。提供了删除旧版Watchman并通过手动安装最新版本来修复的方法,同时给出了修改用户状态目录权限的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

出处

https://stackoverflow.com/questions/40414166/react-native-npm-start-with-watchman-error/40441481#40441481

表现

//启动后给的信息,watchman 起不来

Looking for JS files in
   /Users/tomlucky/otherCode/RN/AwesomeProject 


Metro Bundler ready.

Loading dependency graph...
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)2018-01-09T18:09:37,917: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/tomlucky-state/sock! (No such file or directory)

Watchman:  watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2018-01-09T18:09:37,917: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/tomlucky-state/sock! (No such file or directory)

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 --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2018-01-09T18:09:37,917: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/tomlucky-state/sock! (No such file or directory)

2018-01-09T18:12:02,864: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/tomlucky-state/sock! (No such file or directory)

Watchman:  watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2018-01-09T18:12:02,864: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/tomlucky-state/sock! (No such file or directory)
 ERROR  watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2018-01-09T18:12:02,864: [cli] unable to talk to your watchman on /usr/local/var/run/watchman/tomlucky-state/sock! (No such file or directory)

Loading dependency graph...
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)Process terminated. Press <enter> to close the window

解决方式

删除 watchman (之前用 brew装的):


$ brew install rmtree //我的这句报错,用的 
                      //brew tap beeftornado/rmtree
$ brew rmtree watchman
$ sudo rm -rf /usr/local/var/run/watchman

Manually install Watchman v4.7.0 (credits to David):

$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.7.0  //我用的时候,master就是4.7,所以没必要切branch
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

Chmod your user’s watchman state directory:

//我这个没用,直接就可以跑起来了。
$ chmod 0700 /usr/local/var/run/watchman/<user>-state
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值