您的位置:首页 > Web前端 > React

React Native开发之npm start加速

2016-09-01 16:55 387 查看
在Windows下好不容易安装好React Native环境之后,运行npm start,结果就是无限被等待,快的话160秒(将近3分钟啊。。。。)

而Mac下因为有watchman所以是飞一样的速度,1秒不到,一般几十到几百毫秒。此处一千一万只草泥飞在胸中奔腾…

 

所幸找到一个解决方案了,能让npm start也飞起来(500毫秒左右),操作步骤如下:

1、安装watchman,在Windows下暂时处于alpha版本但是可以使用,是一个zip包 https://facebook.github.io/watchman/docs/install.html | http://bit.ly/watchmanwinalpha
2、添加解压后的watchman到系统环境变量path中,如果成功的话, win + r输入 watchman -v应该返回的是3.7.0
3、右击项目svn目录,取消目录权限为只读,否则会报错,错误如下

[code][Hot ;Module Replacement] Server listening on /hot

React ;packager ready.

Failed ;to build DependencyGraph: Watchman error: query failed: synchronization failed: Permission denied. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html. Error: ;Watchman error: query failed: synchronization failed: Permission denied. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.  ;   at /Users/Ali/Desktop/app/Test/node_modules/react-native/node_modules/node-haste/lib/crawlers/watchman.js:63:11
    at process._tickCallback (node.js:368:9)


[/code]

 

现在再来看看npm start的速度,Windows也能飞起来了^_^





 

参考stackoverflow上的帖子,它给出的是Mac下的方案,使用chmod 777来修改权限为读、写、删,对应Windows下我怀疑是只读,所以试了一下取消只读,居然可以了

React-Native Failed to build DependencyGraph: Watchman error

 

 

鉴于bit.ly被墙,这里我将watchman.zip上传到了博客园,可以点击这里直接下载>>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: