watchman.plist权限在运行react-native初始项目时被拒绝

我开始使用react-native,然后我按照网站上的教程,但是运行示例项目时,它在terminal上返回了一些错误消息:

Looking for JS files in /Users/username/Desktop/nativeTest/BookSearch [06:03:00] <START> Building Dependency Graph [06:03:00] <START> Crawling File System [06:03:00] <START> Loading bundles layout [06:03:00] <END> Loading bundles layout (0ms) React packager ready. 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied Watchman: watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied ERROR watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied Error: watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied at ChildProcess.<anonymous> (/Users/username/Desktop/nativeTest/BookSearch/node_modules/fb-watchman/index.js:194:18) at emitTwo (events.js:88:13) at ChildProcess.emit (events.js:173:7) at maybeClose (internal/child_process.js:819:16) at Socket.<anonymous> (internal/child_process.js:320:11) at emitOne (events.js:78:13) at Socket.emit (events.js:170:7) at Pipe._onclose (net.js:470:12) See http://facebook.github.io/react-native/docs/troubleshooting.html for common problems and solutions. ~ Process terminated. Press <enter> to close the window 

我试图chmod com.github.facebook.watchman.plist,但实际上没有这样的文件。 也许我应该改变文件的path?

其他的事情我已经试过了:

  1. 酿造更新
  2. 酿造升级守望者
  3. brew卸载watchman && brew install –HEAD守望者
  4. 重新启动并重新启动项目

软件包版本(如果需要):

  1. 节点:v5.2.0
  2. 守望者:v4.2.0

确保/Users/username/Library/Users/username/Library/LaunchAgentsusername拥有并具有正确的权限; 这里是我的样子:

 $ ls -ld ~/Library drwx------+ 57 wez users 1938 Nov 6 07:49 /Users/wez/Library $ ls -ld ~/Library/LaunchAgents drwxr-xr-x 3 wez users 102 Dec 11 16:13 /Users/wez/Library/LaunchAgents $ ls -l ~/Library/LaunchAgents/com.github.facebook.watchman.plist -rw-r--r-- 1 wez users 1545 Dec 11 16:13 /Users/wez/Library/LaunchAgents/com.github.facebook.watchman.plist 

另外,请确保您不要以root身份或通过sudo运行守望者。

当前用户对文件夹/Users/[username]/Library/LaunchAgents没有权限。

使用下面的命令来解决这个问题:

 $ sudo chown $(whoami) /Users/$(whoami)/Library/LaunchAgents 
Interesting Posts