When you receive the warning jsregexp library required for Placeholder-transformations in :checkhealth luasnip, the jsregexp C library needs to be compiled. On modern systems (such as Apple Silicon), this often goes wrong because the library is built for the wrong Lua version.
Neovim uses LuaJIT, which is compatible with Lua 5.1. When you install jsregexp via a standard package manager, it is often built for Lua 5.4 or higher. This results in the error message: dlsym(... luaopen_jsregexp): symbol not found.
- Compile for Lua 5.1 Use LuaRocks to build the module specifically for the Lua 5.1 ABI. This ensures that the binary symbols are compatible with Neovim.
luarocks --lua-version 5.1 install jsregexp- Locate the binary file
LuaRocks usually places the file in your home directory. Look for
core.so:
Path: /Users/<USER>/.luarocks/lib/lua/5.1/jsregexp/core.so
- Create a symlink in your Neovim config
Instead of modifying your
package.cpath, we link the folder directly in the Neovim runtime path.
Go to your nvim lua folder
cd ~/.config/nvim/lua/
(You are at: ~/.config/nvim/lua/!)
ln -s ~/.luarocks/lib/lua/5.1/jsregexp/ ./jsregexp
- Create a Proxy file
Because LuaSnip looks for require('jsregexp') but the binary file is named
core.so(inside the jsregexp folder), we need a Lua file to bridge the gap. Create the file~/.config/nvim/lua/jsregexp.luawith the following contents:
-- ~/.config/nvim/lua/jsregexp.lua
-- Redirects require('jsregexp') to the correctly compiled core.so
return require('jsregexp.core')Start Neovim and run the following commands:
Direct check: :lua print(require('jsregexp'))
Result: table: 0x... (Success!)
Health check: :checkhealth luasnip
Result: OK jsregexp is installed
By linking the folder and using a .lua proxy, you bypass the C-loader naming conflicts. You retain the flexibility to update the library outside your Neovim configuration via LuaRocks, while Neovim always finds the correct version.