我开始使用react-native,按照网站上的教程操作,但是在运行示例项目时,终端返回了一些错误信息:
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
我试图修改 com.github.facebook.watchman.plist 的文件权限,但实际上那里没有这个文件。也许我应该更改文件的路径?
我尝试过以下方法:
- brew update
- brew upgrade watchman
- brew uninstall watchman && brew install --HEAD watchman
- 重新启动并重新初始化项目
软件包版本(如果需要):
- node: v5.2.0
- watchman: v4.2.0
$ ls -ld ~/Library/LaunchAgents
lrwxr-xr-x 1 muhaimincs staff 46 Aug 16 11:03 /Users/muhaimincs/Library/LaunchAgents -> /usr/local/opt/mysql/homebrew.mxcl.mysql.plist
- Muhaimin~/Library/LaunchAgents/com.github.facebook.watchman.plist
。您可以在此处查看我的问题http://stackoverflow.com/questions/34912523/error-watchman-no-pretty-get-sockname-when-run-npm-start。 - Muhaimin