Skip to content

Module packer.luarocks not found on mac osx 13.3 #1228

Description

@rahulkp220

Unable to run PackerSync or PackerInstall commands on mac.

  • nvim --version: v0.9.0
  • git --version: 2.39.2
  • Operating system/version: M1 Pro Mac OS Ventura 13.3
  • Terminal name/version: iTerm2

Steps to reproduce

Cloned repo to the right path

│~/.config/nvim
└─> ls -lrt ~/.local/share/nvim/site/pack/packer/start/packer.nvim
total 120
-rw-r--r--  1 user  staff    710 Apr 10 15:33 Dockerfile
-rw-r--r--  1 user  staff   1069 Apr 10 15:33 LICENSE
-rw-r--r--  1 user  staff    328 Apr 10 15:33 Makefile
-rw-r--r--  1 user  staff  33128 Apr 10 15:33 README.md
drwxr-xr-x  3 user  staff     96 Apr 10 15:33 doc
drwxr-xr-x  4 user  staff    128 Apr 10 15:33 lua
-rw-r--r--  1 user  staff     10 Apr 10 15:33 selene.toml
-rw-r--r--  1 user  staff    100 Apr 10 15:33 stylua.toml
drwxr-xr-x  9 user  staff    288 Apr 10 15:33 tests
-rw-r--r--  1 user  staff    610 Apr 10 15:33 vim.toml

Used a simple init.lua using the https://github.com/nvim-lua/kickstart.nvim.
Created a simple lua/ directory and create a file named installer.lua, paste packer configs.

Content of installer.lua

return require('packer').startup(function(use)
    use 'wbthomason/packer.nvim'
end)

File structure of ~/.config/nvim

┌───────────────────>
│~/.config/nvim
└─> tree .
.
├── init.lua
├── lazy-lock.json
└── lua
    └── installer.lua

1 directory, 3 files

Actual behaviour

E5108: Error executing lua ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:110: module 'packer.luarocks' not foun
d:
        no field package.preload['packer.luarocks']
cache_loader: module packer.luarocks not found
cache_loader_lib: module packer.luarocks not found
        no file './packer/luarocks.lua'
        no file '/opt/homebrew/share/luajit-2.1.0-beta3/packer/luarocks.lua'
        no file '/usr/local/share/lua/5.1/packer/luarocks.lua'
        no file '/usr/local/share/lua/5.1/packer/luarocks/init.lua'
        no file '/opt/homebrew/share/lua/5.1/packer/luarocks.lua'
        no file '/opt/homebrew/share/lua/5.1/packer/luarocks/init.lua'
        no file './packer/luarocks.so'
        no file '/usr/local/lib/lua/5.1/packer/luarocks.so'
        no file '/opt/homebrew/lib/lua/5.1/packer/luarocks.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './packer.so'
        no file '/usr/local/lib/lua/5.1/packer.so'
        no file '/opt/homebrew/lib/lua/5.1/packer.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:110: in function 'require_and_configure'
        ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:401: in function 'install'
        [string ":lua"]:1: in main chunk

Activity

  1. added
    v1An issue or PR relevant to packer v2
    on Apr 10, 2023
  2. misku commented on Apr 28, 2023

    @misku

    Same problem here

    • System Version: macOS 12.6 (21G115)
    • NVIM v0.9.0; Build type: Release; LuaJIT 2.1.0-beta3
    • git version 2.39.2
    Error detected while processing BufWritePost Autocommands for "plugins.lua":
    E5108: Error executing lua ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:110: module 'packer.luarocks' not found:
            no field package.preload['packer.luarocks']
    cache_loader: module packer.luarocks not found
    cache_loader_lib: module packer.luarocks not found
            no file './packer/luarocks.lua'
            no file '/opt/homebrew/share/luajit-2.1.0-beta3/packer/luarocks.lua'
            no file '/usr/local/share/lua/5.1/packer/luarocks.lua'
            no file '/usr/local/share/lua/5.1/packer/luarocks/init.lua'
            no file '/opt/homebrew/share/lua/5.1/packer/luarocks.lua'
            no file '/opt/homebrew/share/lua/5.1/packer/luarocks/init.lua'
            no file './packer/luarocks.so'
            no file '/usr/local/lib/lua/5.1/packer/luarocks.so'
            no file '/opt/homebrew/lib/lua/5.1/packer/luarocks.so'
            no file '/usr/local/lib/lua/5.1/loadall.so'
            no file './packer.so'
            no file '/usr/local/lib/lua/5.1/packer.so'
            no file '/opt/homebrew/lib/lua/5.1/packer.so'
            no file '/usr/local/lib/lua/5.1/loadall.so'
    stack traceback:
            [C]: in function 'require'
            ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:110: in function 'require_and_configure'
            ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:576: in function 'sync'
            [string ":lua"]:1: in main chunk
    
  3. misku commented on Apr 28, 2023

    @misku

    The problem is that neovim actually sticks to lua 5.1 for different reasons.

    The error most likely happens due to brew install luarocks being built with lua newer than 5.1. Even if you have lua@5.1 installed with brew, installing luarocks with the mentioned command will install the newest version of lua anyway.

    I worked around it by compiling luarocks manually with lua 5.1 headers from brew. This worked for me:

    $ brew install lua@5.1
    $ curl -R -O https://luarocks.github.io/luarocks/releases/luarocks-3.9.2.tar.gz
    $ tar -zxf luarocks-3.9.2.tar.gz
    $ cd luarocks-3.9.2.tar.gz
    $ ./configure --with-lua-include="/opt/homebrew/Cellar/lua@5.1/5.1.5_8/include/lua5.1"
    $ make && make install
    $ ln -s /usr/local/share/lua /opt/homebrew/share/
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugv1An issue or PR relevant to packer v2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions