2015-12-12 25 views
4

我開始使用react-native,並且我遵循網站上的教程,但運行示例項目時,它在終端上返回了一些錯誤消息:運行反應本機初始項目時,watchman.plist權限被拒絕

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,但實際上這裏沒有這樣的文件。也許我應該改變文件的路徑?

其他的事情我已經試過:

  1. 釀造更新
  2. 沖泡升級守望
  3. 釀造卸載守望& &釀造安裝--HEAD守望
  4. 重新啓動,重新初始化項目

包裝版本(如需要):

  1. 節點:V5.2.0
  2. 守望者:V4.2.0

回答

3

確保/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 

還要確保你不跑守望的根或通過sudo。

+0

問題解決了,謝謝!我沒有意識到plist文件將在第一次運行守望者時創建,'〜/ Library/LaunchAgent'仍然由root擁有。 – xander

+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

+0

這是我想念'〜/ Library/LaunchAgents/com.github.facebook.watchman.plist'。你可以在這裏看到我的問題http://stackoverflow.com/questions/34912523/error-watchman-no-pretty-get-sockname-when-run-npm-start – Muhaimin

3

當前用戶對文件夾/Users/[username]/Library/LaunchAgents沒有權限。

使用下面的命令來解決這個問題:

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