relay icon indicating copy to clipboard operation
relay copied to clipboard

Relay Compiler & Relay LSP broken on latest watchman on homebrew

Open OllieJennings opened this issue 11 months ago • 8 comments

Hey,

TLDR: do not install the latest version of watchman on homebrew.

The latest version of watchman published on the homebrew repository, is currently not working, and failing out due to various issues that can be seen here: https://github.com/facebook/watchman/issues/1264.

I understand that watchman published on homebrew is a community effort, but sadly that has been stuck in trying to get the latest versions to work. (as seen here: https://github.com/Homebrew/homebrew-core/pull/201422).

I have also tried to to install a previous version of watchman on homebrew, but that fails on building.

I have also tried to build the project from source, but again that has failed due to folly exceptions.

I'm currently running on WSL2 hardware, and have 0 issues with relay until now, and it looks like relay heavily depends on watchman for a smooth developer experience.

Any help would be appreciated, l realise that this is not specifically a relay issue, however this does heavily impact the local development environment.

OllieJennings avatar Jan 08 '25 19:01 OllieJennings

Are you having other issues with Watchman at this point, or does it seem to only be impacting Relay compiler?

captbaritone avatar Jan 23 '25 21:01 captbaritone

@captbaritone Issues all-together. It seems to be an issue with the latest version that is published to homebrew (which is quite a few versions out of data).

However it looks like the effort to update watchman in brew is facing a bunch of issues

OllieJennings avatar Jan 24 '25 19:01 OllieJennings

Same case here.

After updating watchman using homebrew on WSL, relay dev stopped working & it keeps throwing this error:

[ERROR] Watchman error: The watchman server reported an error: "watchman::QueryExecError: query failed: synchronization failed: ", while executing command: QueryRequest(
    "query",
    "/home/user/app",
    QueryRequestCommon {
        glob: None,
        glob_noescape: false,
        glob_includedotfiles: false,
        path: Some(
            [
                RecursivePath(
                    "",
                ),
            ],
        ),
       ......
        fields: [
            "name",
            "exists",
        ],
        empty_on_fresh_instance: false,
        omit_changed_files: false,
        fail_if_no_saved_state: false,
        case_sensitive: false,
        sync_timeout: Default,
        settle_period: None,
        settle_timeout: None,
        dedup_results: false,
        lock_timeout: None,
        request_id: None,
        always_include_directories: false,
    },
)

I tried:

  • Uninstalling then reinstalling
  • Uninstalling then re-installing using sudo apt-get watchman (though I know it's not recommended in the docs)
  • Installing an older version of the formula by downloading it & running the command HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --formula ./watchman.rb (Would get error Error: Formula installation already attempted: watchman)

but nothing is working so far...

Have you managed to solve the issue somehow or find a workaround? It's been several hours & nothing seems to work...

MTG2000 avatar Jan 29 '25 15:01 MTG2000

@MTG2000 No sadly l haven't gotten it to work, my "work-around" now is to uninstall watchman and just run the relay-compiler one off anytime l need to generate files.

OllieJennings avatar Jan 29 '25 17:01 OllieJennings

A temporary workaround for this problem is to use a tool that can watch the npm script, such as turborepo.

sho-pb avatar Feb 05 '25 09:02 sho-pb

@sho-pb We are using turborepo, but what do you mean exactly by watching the npm script? Could you give me an example?

MTG2000 avatar Feb 07 '25 10:02 MTG2000

Hey, @MTG2000

I have created a sample repository: https://github.com/sho-pb/relay-watch-with-turborepo-example

By running pnpm run relay:watch in apps/web, you can watch for file changes and execute relay-compiler.

The important files are as follows:

  • https://github.com/sho-pb/relay-watch-with-turborepo-example/blob/main/turbo.json
  • https://github.com/sho-pb/relay-watch-with-turborepo-example/blob/main/apps/web/package.json

In other words, by using Turborepo's watch mode to run the relay-compiler, it is possible to achieve the same functionality as Watchman.

https://turbo.build/repo/docs/reference/watch

However, I have not compared the performance with Watchman. At the very least, it works without any issues in my project.

If the problem has been resolved in the latest version of watchman, it is better to use that version. Perhaps. 😅

sho-pb avatar Feb 14 '25 04:02 sho-pb

@sho-pb Thanks a lot for the example, I learned a new interesting thing!

Also, wanted to report that I tried the latest watchman version from homebrew, and I'm not getting the error that I was getting with the previous version, so hopefully they fixed the issue.

MTG2000 avatar Feb 14 '25 09:02 MTG2000