【问题标题】:watchman.plist permission denied when running a react-native initial project运行本机初始项目时,watchman.plist 权限被拒绝
【发布时间】:2015-12-12 22:19:56
【问题描述】:

我开始使用 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

我尝试 chmod com.github.facebook.watchman.plist 但实际上那里没有这样的文件。也许我应该更改文件的路径?

我尝试过的其他事情:

  1. 酿造更新
  2. brew 升级守望者
  3. brew uninstall watchman && brew install --HEAD watchman
  4. 重启并重新初始化项目

包版本(如果需要):

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

【问题讨论】:

    标签: node.js react-native watchman


    【解决方案1】:

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

    使用以下命令解决此问题:

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

    【讨论】:

      【解决方案2】:

      确保/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 运行 watchman。

      【讨论】:

      • 问题已解决,谢谢!我没有意识到 plist 文件会在第一次运行 watchman 时创建,~/Library/LaunchAgent 仍然归 root 所有。
      • 我的不一样。我该如何解决它$ ls -ld ~/Library/LaunchAgentslrwxr-xr-x 1 muhaimincs staff 46 Aug 16 11:03 /Users/muhaimincs/Library/LaunchAgents -&gt; /usr/local/opt/mysql/homebrew.mxcl.mysql.plist
      • 这是我想念的~/Library/LaunchAgents/com.github.facebook.watchman.plist。你可以在这里看到我的问题stackoverflow.com/questions/34912523/…
      • 运行 -$sudo chown ~/Library/LaunchAgents
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-29
      • 1970-01-01
      • 2023-02-02
      • 2019-12-27
      • 1970-01-01
      • 2017-03-24
      • 1970-01-01
      相关资源
      最近更新 更多