## 事象
[[Neovim]]にて、[[none-ls.nvim]]を使って[[Prettier]]と[[Biome]]を設定すると、[[Prettier]]だけでなく[[Biome]]も実行され、しかも見つからないのでエラーになる。[[Prettier]]だけ実行されてほしい。
## 再現方法
### 前提条件
#### globalの状況
- [[Prettier]]はインストール済
- [[Biome]]は未インストール
#### [[none-ls.nvim]]の設定
```lua
{
"nvimtools/none-ls.nvim",
config = function()
local null_ls = require("null-ls")
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
null_ls.setup({
sources = {
null_ls.builtins.formatting.biome,
null_ls.builtins.formatting.prettier,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end
end,
})
end,
}
```
### 手順
[[Bun]]プロジェクトを作成する。
```console
bun init . -y
```
`index.ts`を開いて保存すると、以下のwarningが出る。
```warn
Warn 10:41:00 notify.warn null-ls [null-ls] failed to run generator: ....local/share/nvim/lazy/none-ls.nvim/lua/null-ls/loop.lua:165: command biome is not executable (make sure it's installed and on your $PATH)
```
[[Biome]]を実行しようとしてエラーになっている。
## 原因
[[Biome]]の設定は`dynamic_command`を使っているため、ローカルに[[Biome]]がインストールされていない場合、グローバルに[[Biome]]がインストールされていなくても、グローバルの`biome`コマンドにフォールバックされてしまうから。
> [[📕none-lsのHelpers設定を読み解く#dynamic_command]]
## 解決方法
`only_local`を指定し、[[ローカルにコマンドが存在しなければ実行しない (none-ls.nvim)|ローカルにコマンドが存在しなければ実行しない]]ようにする。
```lua
local sources = {
null_ls.builtins.formatting.biome.with({
only_local = "node_modules/.bin",
}),
}
```
## 参考
- [none\-ls\.nvim/doc/BUILTIN\_CONFIG\.md at main · nvimtools/none\-ls\.nvim](https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md#using-local-executables)