agzam / spacehammer

Hammerspoon config inspired by Spacemacs
MIT License
556 stars 70 forks source link

_coresetup.lua:662: module 'core' not found #160

Closed ahmed-rezk-dev closed 2 years ago

ahmed-rezk-dev commented 2 years ago

*** ERROR: ...poon.app/Contents/Resources/extensions/hs/_coresetup.lua:662: module 'core' not found: no field package.preload['core']

agzam commented 2 years ago

Please provide the version numbers. It doesn't seem to be reproducible on:

Fennel 1.0.0 on Lua 5.4 and Hammerspoon 0.9.93 (6148)

factotvm commented 2 years ago

I'm experiencing the same issue. I have it working on an old machine, but a new one won't load.

❯ fennel -v
Fennel 1.0.0 on Lua 5.4
❯ lua -v
Lua 5.4.3  Copyright (C) 1994-2021 Lua.org, PUC-Rio

Hammerspoon: Version 0.9.93 (6148)

This is on an M1 Mac with Homebrew (in /opt/homebrew/).

Error:

2022-01-21 09:13:29: *** ERROR: ...poon.app/Contents/Resources/extensions/hs/_coresetup.lua:662: module 'fennel' not found:
Grazfather commented 2 years ago

In the hammerspoon console print out package.path. Can fennel be found in there? I actually reported a bug about this thing Hammerspoon/hammerspoon#3081 which was fixed.

Basically hammerspoon doesn't know to look in /opt/homebrew until the above fix is released you can either explicitly set the LUAPATH or add fennel to /usr/local/lib/lua/5.4/_

factotvm commented 2 years ago

I tried the new Hammerspoon version, and it didn't work. I also updated init.lua to several different incantations that look something similar to:

package.path = package.path .. ";" .. "/opt/homebrew/Cellar/lua/5.4.3_1/?.lua;"

I know nothing about Lua or Fennel, sorry... I'm trying to look at the lines below for a hint.

(I forgot to mention I also tried LUA_PATH... could be PEBKAC.)

Grazfather commented 2 years ago

did you use the version linked in the ticket, or the release? I am at work and cannot check my package.page at the moment, but shouldn't your path contain your luarocks dir?

factotvm commented 2 years ago

The pre-release version he linked to in the ticket.

factotvm commented 2 years ago

Hammerspoon: Version 0.9.93 (6172)

factotvm commented 2 years ago

Here is package.path

/Users/me/.hammerspoon/?.lua;/Users/me/.hammerspoon/?/init.lua;/Users/me/.hammerspoon/Spoons/?.spoon/init.lua;/opt/homebrew/share/lua/5.4/?.lua;/opt/homebrew/share/lua/5.4/?/init.lua;/opt/homebrew/lib/lua/5.4/?.lua;/opt/homebrew/lib/lua/5.4/?/init.lua;/usr/local/share/lua/5.4/?.lua;/usr/local/share/lua/5.4/?/init.lua;/usr/local/lib/lua/5.4/?.lua;/usr/local/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua;/Applications/Hammerspoon.app/Contents/Resources/extensions/?.lua;/Applications/Hammerspoon.app/Contents/Resources/extensions/?/init.lua;/opt/homebrew/Cellar/lua/5.4.3_1/?.lua;;/Users/me/.luarocks/share/lua/5.4/?.lua;/Users/me/.luarocks/share/lua/5.4/?/init.lua;/Users/me/.luarocks/share/lua/5.3/?.lua;/Users/me/.luarocks/share/lua/5.3/?/init.lua

You can see both... (mine is the Cellar one). Have I don't something else? On the command line, everything seems fine.

factotvm commented 2 years ago

Wow, I have no idea...

❯ lua
Lua 5.4.3  Copyright (C) 1994-2021 Lua.org, PUC-Rio
> fennel = require("fennel")
stdin:1: module 'fennel' not found:
    no field package.preload['fennel']
    no file '/opt/homebrew/share/lua/5.4/fennel.lua'
    no file '/opt/homebrew/share/lua/5.4/fennel/init.lua'
    no file '/opt/homebrew/lib/lua/5.4/fennel.lua'
    no file '/opt/homebrew/lib/lua/5.4/fennel/init.lua'
    no file './fennel.lua'
    no file './fennel/init.lua'
    no file '/opt/homebrew/lib/lua/5.4/fennel.so'
    no file '/opt/homebrew/lib/lua/5.4/loadall.so'
    no file './fennel.so'
stack traceback:
    [C]: in function 'require'
    stdin:1: in main chunk
    [C]: in ?

❯ luarocks install fennel
Installing https://luarocks.org/fennel-1.0.0-1.src.rock

fennel 1.0.0-1 depends on lua >= 5.1 (5.4-1 provided by VM)
fennel 1.0.0-1 is now installed in /opt/homebrew (license: MIT)

❯ lua
Lua 5.4.3  Copyright (C) 1994-2021 Lua.org, PUC-Rio
> fennel = require("fennel")
>

So, I could have sworn I followed the install instructions. But, maybe I lost it on a brew reinstall. Installing fennel again has fixed it.

I was able to remove my path setting in init.lua and everything is working, so the Hammerspoon update appears to fix it. Thanks.

Grazfather commented 2 years ago

Happy to hear!