biomejs / biome-zed

Biome extension for Zed
https://biomejs.dev
MIT License
165 stars 6 forks source link

Failed to run biome (zed 0.157.5) #52

Open cherewaty opened 4 weeks ago

cherewaty commented 4 weeks ago

Getting a "Failed to run biome. Click to show error." Was working until the last few days. I'm assuming it was a zed update.

The error:

Language server error: biome

failed to spawn command. path: "/Users/me/project/node_modules/@biomejs/biome/bin/biome", working directory: "/Users/me/project", args: ["lsp-proxy", "--config-path", "biome.json"]
-- stderr--

My biome.json is at the root of the workspace.

The relevant parts of my zed settings, with new additions from https://biomejs.dev/reference/zed/:

{
    "language_servers": ["biome", "!prettier", "!eslint"],
    "lsp": {
        "biome": {
            "settings": {
                "require_config_file": true
            }
        }
    },
    "formatter": {
        "language_server": {
            "name": "biome"
        }
    },
    "code_actions_on_format": {
        "source.fixAll.biome": true,
        "source.organizeImports.biome": true
    },
}

zed 0.157.5, macOS 15.0.1

luckydye commented 3 weeks ago

I can't reproduce this issue, can you provide more information? I am on latest versions.

Also check if /Users/me/project/node_modules/@biomejs/biome/bin/biome actually exists.

michalmo commented 3 weeks ago

I recently started having the same issue.

In my case project dependencies are managed by yarn (pnp) so node_modules is largely empty. I do have the yarn sdks installed (https://zed.dev/docs/languages/yarn).

I am able to make it work by forcing the path:

{
  "lsp": {
    "biome": {
      "binary": {
        "path": ".yarn/unplugged/@biomejs-cli-darwin-arm64-npm-1.9.3-0fbea5824d/node_modules/@biomejs/cli-darwin-arm64/biome",
        "arguments": [
          "lsp-proxy"
        ]
      }
    }
  }
}

However this isn't ideal since it will need to be updated with every version update. Also the path returned by yarn bin biome (.yarn/unplugged/@biomejs-biome-npm-1.9.3-a7b2320732/node_modules/@biomejs/biome/bin/biome) doesn't work, it needs to be the path to the platform specific package.

Marcisbee commented 2 weeks ago

I get the same error. The problem here is something else in my case for example. Clean install with yarn v4.0.2 doesn't make this bin file executable.

Error:

Language server error: biome

failed to spawn command. path: "/private/var/www/project/node_modules/@biomejs/biome/bin/biome", working directory: "/private/var/www/project", args: ["lsp-proxy", "--config-path", "biome.json"]
-- stderr--

Error from sh:

❯ /private/var/www/project/node_modules/@biomejs/biome/bin/biome
zsh: permission denied: /private/var/www/project/node_modules/@biomejs/biome/bin/biome

When I manually update permissions, extension then works in zed. When I run yarn install again, it changes permissions once more and get the same error as before.

Issue is no longer present if I upgrade to latest yarn v4.5.1. Hope this helps someone.