【问题标题】:Elixir phoenix live reload doesn't workElixir phoenix live reload 不起作用
【发布时间】:2017-12-05 03:38:57
【问题描述】:

我的操作系统是最新的 macOS high sierra。我通过 Homebrew 安装了 elixir 和所有依赖项。我创建了一个新的 Phoenix 应用程序。它显示了一些错误。实时重新加载不起作用。以下是信息。

[error] Can't find executable `mac_listener`
[warn] Could not start Phoenix live-reload because we cannot listen to the file system.
You don't need to worry! This is an optional feature used during development to
refresh your browser when you save files and it does not affect production.

似乎某些文件更改侦听器服务没有运行。但我不知道如何解决它。

【问题讨论】:

  • 如果你手动运行./deps/fs/priv/mac_listener会发生什么?
  • @Dogbert 没有这样的文件或目录。我检查了 deps 文件夹。没有 fs 模块,只有一个 file_system。
  • 啊,Phoenix 1.3 中依赖项的名称似乎已更改。如果你运行 ./deps/file_system/priv/mac_listener -h 会发生什么?
  • @Dogbert 它也显示没有这样的文件或目录。我手动检查了 file_system 模块。 priv 文件夹为空。里面什么都没有。
  • mix deps.compile file_system 有效吗?

标签: elixir phoenix-framework


【解决方案1】:

我通过重新安装命令行工具解决了这个问题。 打开 bash,然后输入:

xcode-select --install

然后,运行mix deps.compile file_system 重新编译file_system 模块。完成。

【讨论】:

  • 这并不能解决所有情况下的错误。奇怪的是,我在一个 Phoenix 安装中弹出了这个错误,但是在同一台机器上的一个单独的 Phoenix 安装中文件监视工作正常。我很困惑。
  • 这个问题还有其他解决方案吗?
【解决方案2】:

上述答案对我有用(运行 Mojave),但正如评论的那样,显然不适用于所有人。根据我在 Elixir 论坛上遇到的讨论,这似乎是其他用户也遇到的问题:Can’t find executable mac_listener - [error] exited in: GenServer.call

一位用户指出,在尝试了以下所有方法后,他们仍然遇到问题:

  • 卸载 Xcode
  • 删除命令行工具
  • mix deps.clean --all && rm -rf _build deps
  • 重新安装 Xcode
  • 运行 xcode-select --install,接受许可协议
  • 重启
  • 运行 mix deps.get && mix deps.compile file_system
  • 找到 /CoreServices.h
  • export CFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include"

似乎帮助特定用户的最后一步是运行以下命令:open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

另一个 Catalina 用户建议通过运行 export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" 然后重新编译 deps 来在 .bash_profile 中设置正确的头文件路径。

希望这些附加信息对某人有所帮助。

【讨论】:

    【解决方案3】:

    以上解决方案都不适合我。在我的情况下,我必须做的是让 phoenix live reload 工作(设置正常),删除mix.lock 文件,然后运行mix deps.get && mix deps.compile file_system

    【讨论】:

      【解决方案4】:

      我已经解决了这个问题,因为我已经安装了 xcode-select:

       sudo xcode-select --reset
      

      然后:

      mix deps.compile file_system
      

      您可以检查是否安装了:xcode-select -v 走在路上: xcode-select -p

      【讨论】:

        猜你喜欢
        • 2017-12-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-08-24
        • 1970-01-01
        • 2013-04-20
        • 2022-08-18
        相关资源
        最近更新 更多