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

Installation step missing? #67

Closed
Nielius opened this issue Sep 17, 2020 · 8 comments
Closed

Installation step missing? #67

Nielius opened this issue Sep 17, 2020 · 8 comments

Comments

@Nielius
Copy link

Nielius commented Sep 17, 2020

I wanted to try this cool project out, but it looks like a step in the installation process is missing: it looks like you need to compile the fennel files. Is that right?

What I did

I didn't have luarocks or fennel installed, so I did this:

brew install luarocks
luarocks install fennel

git clone https://github.com/agzam/spacehammer ~/.hammerspoon

Then I reloaded the hammerspoon config with the button in the top-right. (Note I didn't reboot.)

Expected result

Cool spacehammer keybindings.

Actual result

2020-09-17 16:54:20: -- Lazy extension loading enabled
2020-09-17 16:54:20: -- Loading ~/.hammerspoon/init.lua
2020-09-17 16:54:20: -- Loading extension: alert
2020-09-17 16:54:20: *** ERROR: ...app/Contents/Resources/extensions/hs/_coresetup/init.lua:597: module 'core' not found:
	no field package.preload['core']
	no file '/Users/nielius/.hammerspoon/core.lua'
	no file '/Users/nielius/.hammerspoon/core/init.lua'
	no file '/Users/nielius/.hammerspoon/Spoons/core.spoon/init.lua'
	no file '/usr/local/share/lua/5.3/core.lua'
	no file '/usr/local/share/lua/5.3/core/init.lua'
	no file '/usr/local/lib/lua/5.3/core.lua'
	no file '/usr/local/lib/lua/5.3/core/init.lua'
	no file './core.lua'
	no file './core/init.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/core.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/core/init.lua'
	no file '/Users/nielius/.hammerspoon/core.so'
	no file '/usr/local/lib/lua/5.3/core.so'
	no file '/usr/local/lib/lua/5.3/loadall.so'
	no file './core.so'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/core.so'
stack traceback:
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:597: in function 'require'
	/Users/nielius/.hammerspoon/init.lua:19: in main chunk
	[C]: in function 'xpcall'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:648: in function 'hs._coresetup.setup'
	(...tail calls...)

What resolved it for me

I added this makefile:

SOURCES := $(shell find ./ -type f -name '*.fnl')

TARGETS := $(patsubst %.fnl, %.lua, $(SOURCES))

all: $(TARGETS)

%.lua: %.fnl
	fennel --compile $< > $@

and ran make all.
(One file actually filed to compile, but that didn't seem to matter.)

P.S.

Awesome project! I look forward to exploring it more.

@jaidetree
Copy link
Collaborator

Thanks for reporting this.

If you install luarocks and fennel, you should not need to compile the fennel into lua. You will need to reboot as our init.lua changes the load paths to support fennel on startup but doesn't change that on future reloads.

@tntmarket
Copy link

tntmarket commented Sep 20, 2020

I'm not sure if this is the same issue, but I:

  • Updated to the latest hammerspoon
  • ran brew install luarocks
  • ran luarocks install fennel
  • ran git clone https://github.com/agzam/spacehammer ~/.hammerspoon

And I get this error whenever I reload the config:

2020-09-20 12:15:28: -- Lazy extension loading enabled
2020-09-20 12:15:28: -- Loading ~/.hammerspoon/init.lua
2020-09-20 12:15:28: -- Loading extension: alert
2020-09-20 12:15:28: *** ERROR: ...app/Contents/Resources/extensions/hs/_coresetup/init.lua:651: module 'fennel' not found:
	no field package.preload['fennel']
	no file '/Users/davelu/.hammerspoon/fennel.lua'
	no file '/Users/davelu/.hammerspoon/fennel/init.lua'
	no file '/Users/davelu/.hammerspoon/Spoons/fennel.spoon/init.lua'
	no file '/usr/local/share/lua/5.4/fennel.lua'
	no file '/usr/local/share/lua/5.4/fennel/init.lua'
	no file '/usr/local/lib/lua/5.4/fennel.lua'
	no file '/usr/local/lib/lua/5.4/fennel/init.lua'
	no file './fennel.lua'
	no file './fennel/init.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/fennel.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/fennel/init.lua'
	no file '/Users/davelu/.hammerspoon/fennel.so'
	no file '/usr/local/lib/lua/5.4/fennel.so'
	no file '/usr/local/lib/lua/5.4/loadall.so'
	no file './fennel.so'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/fennel.so'
stack traceback:
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:651: in function 'require'
	/Users/davelu/.hammerspoon/init.lua:16: in main chunk
	[C]: in function 'xpcall'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:702: in function 'hs._coresetup.setup'
	(...tail calls...)

Spacehammer was working ok prior to me updating hammerspoon

@jaidetree
Copy link
Collaborator

jaidetree commented Sep 20, 2020

@tntmarket Can you please create a separate ticket for this? I just saw a new Hammerspoon was dropped and it's good to track these issues separately. Thanks! In the future, please report an issue like this as a separate issue. Thank you!

@larryskye
Copy link

For others running into this issue, next fixed it for me:

-- ...
package.path = package.path .. ";" .. "/usr/local/share/lua/5.3/?.lua"
fennel = require("fennel")
-- ...

@PaulMorris
Copy link

I did the same steps as @tntmarket and got the same error. Thanks @larryskye , adding that line to init.lua fixed it for me.

@frenchy64
Copy link

frenchy64 commented Nov 30, 2020

I managed to fix this by upgrading to lua 5.4 via these steps, except I changed the last step install fennel to

luarocks install --local fennel

as otherwise it would not install fennel to ~/.luarocks.

@yqrashawn
Copy link

For me reinstall a latest hammerspoon fix the problem

@Grazfather
Copy link
Collaborator

The issue seems to be that fennel was not installed into the same version of Lua that Hammerspoon is using. Make sure to use the correct one and the issue should go away.

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

8 participants