Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run biome (zed 0.157.5) #52

Open
cherewaty opened this issue Oct 17, 2024 · 4 comments
Open

Failed to run biome (zed 0.157.5) #52

cherewaty opened this issue Oct 17, 2024 · 4 comments

Comments

@cherewaty
Copy link

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
Copy link
Collaborator

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
Copy link

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
Copy link

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.

@chungweileong94
Copy link
Contributor

chungweileong94 commented Nov 26, 2024

Currently, the extension will only try to use the LSP bin from node_modules/@biomejs/biome/bin/biome

if self.worktree_biome_exists(worktree) {

There was a limitation in Zed at the time, where we were unable to check if the LSP bin exists in node_modules, so the workaround at the time was to check if Biome is listed as part of the dependencies, then naively access the Biome LSP from node_modules, #9 (comment). So I'm not sure if the current Zed version still has issues with looking up the LSP bin.

Which means that the yarn pnp is not supported OOB, so the workaround is to define the Biome LSP bin as @michalmo mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants