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 instructions #2

Closed
amitkot opened this issue May 10, 2022 · 10 comments
Closed

Installation instructions #2

amitkot opened this issue May 10, 2022 · 10 comments

Comments

@amitkot
Copy link

amitkot commented May 10, 2022

I followed the installation instructions and made sure I have libyaml installed on my mac:

> ls /usr/local/Cellar/libyaml/0.2.5/
Changes              INSTALL_RECEIPT.json License              ReadMe.md            include              lib

Setting up this plugin in neovim this way:

  use {
  'akinsho/pubspec-assist.nvim',
  requires = 'plenary.nvim',
  rocks = {
    {
      'lyaml',
      server = 'http://rocks.moonscript.org',
      -- If using macOS or Ubuntu, you may need to install the `libyaml` package.
      -- if you install libyaml with homebrew you will need to set the YAML_DIR
      -- to the location of the homebrew installation of libyaml e.g.
      env = { YAML_DIR = '/usr/local/Cellar/libyaml/0.2.5/' },
    },
  },
  config = function()
    require('pubspec-assist').setup()
  end,
}

I get this error when opening pubspec.yaml:

Error detected while processing BufEnter Autocommands for "pubspec.yaml":                                                                                                       
Error executing lua callback: ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: .../packer/start/pubspec-assist.nvim/lua/p
ubspec-assist.lua:274: module 'lyaml' not found:                                                                                                                                
        no field package.preload['lyaml']                                                                                                                                       
        no file './lyaml.lua'                                                                                                                                                   
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/luajit-2.1.0-beta3/lyaml.lua'                                                                            
        no file '/usr/local/share/lua/5.1/lyaml.lua'                                                                                                                            
        no file '/usr/local/share/lua/5.1/lyaml/init.lua'                                                                                                                       
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/lua/5.1/lyaml.lua'                                                                                       
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/lua/5.1/lyaml/init.lua'                                                                                  
        no file '/Users/amit/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lyaml.lua'                                                                                  
        no file '/Users/amit/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lyaml/init.lua'                                                                             
        no file '/Users/amit/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/lyaml.lua'                                                                         
        no file '/Users/amit/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/lyaml/init.lua'                                                                    
        no file './lyaml.so'                                                                                                                                                    
        no file '/usr/local/lib/lua/5.1/lyaml.so'                                                                                                                               
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/lib/lua/5.1/lyaml.so'                                                                                          
        no file '/usr/local/lib/lua/5.1/loadall.so'                                                                                                                             
        no file '/Users/amit/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/lyaml.so'                                                                                     
stack traceback:                                                                                                                                                                
        [C]: in function 'error'                                                                                                                                                
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: in function 'callback_or_next'                                                                          
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:40: in function 'step'                                                                                      
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:43: in function 'execute'                                                                                   
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:113: in function <...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:112>

Do I need to install lyaml separately?

@akinsho
Copy link
Owner

akinsho commented May 13, 2022

@amitkot so no one else has ever tested this so not sure if those instructions will be enough for everyone but that's what I used and that works on my machine (classic). Can you verify what happens when you try lua =require('lyaml') it seems to me that isn't actually available on your system like the installation didn't work. Can you confirm in packer using PackerSync that it shows lyaml as actually installed.

@akinsho
Copy link
Owner

akinsho commented May 13, 2022

Also, I guess it's important to clarify that thing in /usr/local/Cellar are actually available in your PATH right? i.e. you've added this directory to your path? Which is just part of setting up homebrew, but could be a step you've missed.

@amitkot
Copy link
Author

amitkot commented May 15, 2022

@akinsho when I run :lua =require('lyaml') I get this error:

E5108: Error executing lua [string ":lua"]:1: module 'lyaml' not found:                 
        no field package.preload['lyaml']                                               
        no file './lyaml.lua'                                                           
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/luajit-2.1.0-beta
3/lyaml.lua'                                                                            
        no file '/usr/local/share/lua/5.1/lyaml.lua'                                    
        no file '/usr/local/share/lua/5.1/lyaml/init.lua'                               
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/lua/5.1/lyaml.lua
'                                                                                       
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/lua/5.1/lyaml/ini
t.lua'                                                                                  
        no file '/Users/xxusername/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lyam
l.lua'                                                                                  
        no file '/Users/xxusername/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lyam
l/init.lua'                                                                             
        no file '/Users/xxusername/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks
-5.1/lyaml.lua'                                                                         
        no file '/Users/xxusername/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks
-5.1/lyaml/init.lua'                                                                    
        no file './lyaml.so'                                                            
        no file '/usr/local/lib/lua/5.1/lyaml.so'                                       
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/lib/lua/5.1/lyaml.so'  
        no file '/usr/local/lib/lua/5.1/loadall.so'                                     
        no file '/Users/xxusername/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/lyaml.
so'                                                                                     
stack traceback:                                                                        
        [C]: in function 'require'                                                      
        [string ":lua"]:1: in main chunk

@amitkot
Copy link
Author

amitkot commented May 15, 2022

Binaries from Cellar-installed apps are linked to /usr/local/bin, is that what you refer to?

Should I install additional dependencies? I tried installing luarocks using brew but it had no effect.

@akinsho
Copy link
Owner

akinsho commented May 15, 2022

Oh, sorry @amitkot I didn't notice it looks like you didn't install lyaml via packer is that correct? I don't know how to expose a luarock to neovim without packer, so the instruction really depends on using packer, and it's specific installation process for luarocks. Is that what you used, or you used homebrew because that won't work out of the box since that won't necessarily be visible to nvim

@amitkot
Copy link
Author

amitkot commented May 15, 2022

@akinsho sorry for not being clear, I am using packer, I am just trying out things to try and find out what is missing in the package installation. I also tried installing lyaml from the brew-installed luarocks but it did not help.

When I installed this package using packer initially there were rotating lines of the build process, so it seemed as though it was trying to build something (maybe lyaml?). When I look at nvim's cache dir I don't see lyaml there.

Long shell output:
$ cd ~/.cache/nvim/packer_hererocks/
$ fd . | grep lua
./2.1.0-beta3/bin/get_deactivated_path.lua
./2.1.0-beta3/bin/lua
./2.1.0-beta3/bin/luarocks
./2.1.0-beta3/bin/luarocks-admin
./2.1.0-beta3/etc/luarocks
./2.1.0-beta3/etc/luarocks/config-5.1.lua
./2.1.0-beta3/include/lua.h
./2.1.0-beta3/include/lua.hpp
./2.1.0-beta3/include/luaconf.h
./2.1.0-beta3/include/luajit.h
./2.1.0-beta3/include/lualib.h
./2.1.0-beta3/lib/libluajit-5.1.a
./2.1.0-beta3/lib/libluajit-5.1.so.2
./2.1.0-beta3/share/lua
./2.1.0-beta3/share/lua/5.1
./2.1.0-beta3/share/lua/5.1/jit
./2.1.0-beta3/share/lua/5.1/jit/bc.lua
./2.1.0-beta3/share/lua/5.1/jit/bcsave.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_arm.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_arm64.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_arm64be.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_mips.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_mips64.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_mips64el.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_mipsel.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_ppc.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_x64.lua
./2.1.0-beta3/share/lua/5.1/jit/dis_x86.lua
./2.1.0-beta3/share/lua/5.1/jit/dump.lua
./2.1.0-beta3/share/lua/5.1/jit/p.lua
./2.1.0-beta3/share/lua/5.1/jit/v.lua
./2.1.0-beta3/share/lua/5.1/jit/vmdef.lua
./2.1.0-beta3/share/lua/5.1/jit/zone.lua
./2.1.0-beta3/share/lua/5.1/luarocks
./2.1.0-beta3/share/lua/5.1/luarocks/admin
./2.1.0-beta3/share/lua/5.1/luarocks/admin/cache.lua
./2.1.0-beta3/share/lua/5.1/luarocks/admin/cmd
./2.1.0-beta3/share/lua/5.1/luarocks/admin/cmd/add.lua
./2.1.0-beta3/share/lua/5.1/luarocks/admin/cmd/make_manifest.lua
./2.1.0-beta3/share/lua/5.1/luarocks/admin/cmd/refresh_cache.lua
./2.1.0-beta3/share/lua/5.1/luarocks/admin/cmd/remove.lua
./2.1.0-beta3/share/lua/5.1/luarocks/admin/index.lua
./2.1.0-beta3/share/lua/5.1/luarocks/argparse.lua
./2.1.0-beta3/share/lua/5.1/luarocks/build
./2.1.0-beta3/share/lua/5.1/luarocks/build/builtin.lua
./2.1.0-beta3/share/lua/5.1/luarocks/build/cmake.lua
./2.1.0-beta3/share/lua/5.1/luarocks/build/command.lua
./2.1.0-beta3/share/lua/5.1/luarocks/build/make.lua
./2.1.0-beta3/share/lua/5.1/luarocks/build.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/build.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/config.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/doc.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/download.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/init.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/install.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/lint.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/list.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/make.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/new_version.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/pack.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/path.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/purge.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/remove.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/search.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/show.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/test.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/unpack.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/upload.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/which.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd/write_rockspec.lua
./2.1.0-beta3/share/lua/5.1/luarocks/cmd.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core
./2.1.0-beta3/share/lua/5.1/luarocks/core/cfg.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core/dir.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core/manif.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core/path.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core/persist.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core/sysdetect.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core/util.lua
./2.1.0-beta3/share/lua/5.1/luarocks/core/vers.lua
./2.1.0-beta3/share/lua/5.1/luarocks/deplocks.lua
./2.1.0-beta3/share/lua/5.1/luarocks/deps.lua
./2.1.0-beta3/share/lua/5.1/luarocks/dir.lua
./2.1.0-beta3/share/lua/5.1/luarocks/download.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/cvs.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/git.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/git_file.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/git_http.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/git_https.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/git_ssh.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/hg.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/hg_http.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/hg_https.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/hg_ssh.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/sscm.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch/svn.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fetch.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs
./2.1.0-beta3/share/lua/5.1/luarocks/fs/freebsd.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/linux.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/lua.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/macosx.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/tools.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/unix
./2.1.0-beta3/share/lua/5.1/luarocks/fs/unix/tools.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/unix.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/win32
./2.1.0-beta3/share/lua/5.1/luarocks/fs/win32/tools.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs/win32.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fs.lua
./2.1.0-beta3/share/lua/5.1/luarocks/fun.lua
./2.1.0-beta3/share/lua/5.1/luarocks/loader.lua
./2.1.0-beta3/share/lua/5.1/luarocks/manif
./2.1.0-beta3/share/lua/5.1/luarocks/manif/writer.lua
./2.1.0-beta3/share/lua/5.1/luarocks/manif.lua
./2.1.0-beta3/share/lua/5.1/luarocks/pack.lua
./2.1.0-beta3/share/lua/5.1/luarocks/path.lua
./2.1.0-beta3/share/lua/5.1/luarocks/persist.lua
./2.1.0-beta3/share/lua/5.1/luarocks/queries.lua
./2.1.0-beta3/share/lua/5.1/luarocks/remove.lua
./2.1.0-beta3/share/lua/5.1/luarocks/repos.lua
./2.1.0-beta3/share/lua/5.1/luarocks/require.lua
./2.1.0-beta3/share/lua/5.1/luarocks/results.lua
./2.1.0-beta3/share/lua/5.1/luarocks/rockspecs.lua
./2.1.0-beta3/share/lua/5.1/luarocks/search.lua
./2.1.0-beta3/share/lua/5.1/luarocks/signing.lua
./2.1.0-beta3/share/lua/5.1/luarocks/test
./2.1.0-beta3/share/lua/5.1/luarocks/test/busted.lua
./2.1.0-beta3/share/lua/5.1/luarocks/test/command.lua
./2.1.0-beta3/share/lua/5.1/luarocks/test.lua
./2.1.0-beta3/share/lua/5.1/luarocks/tools
./2.1.0-beta3/share/lua/5.1/luarocks/tools/patch.lua
./2.1.0-beta3/share/lua/5.1/luarocks/tools/tar.lua
./2.1.0-beta3/share/lua/5.1/luarocks/tools/zip.lua
./2.1.0-beta3/share/lua/5.1/luarocks/type
./2.1.0-beta3/share/lua/5.1/luarocks/type/manifest.lua
./2.1.0-beta3/share/lua/5.1/luarocks/type/rockspec.lua
./2.1.0-beta3/share/lua/5.1/luarocks/type_check.lua
./2.1.0-beta3/share/lua/5.1/luarocks/upload
./2.1.0-beta3/share/lua/5.1/luarocks/upload/api.lua
./2.1.0-beta3/share/lua/5.1/luarocks/upload/multipart.lua
./2.1.0-beta3/share/lua/5.1/luarocks/util.lua

@akinsho
Copy link
Owner

akinsho commented May 20, 2022

@amitkot I'm considering vendoring lyaml as a git submodule but tbh I much rather prefer packer rocks for this. Can you please confirm if you are able to install any other luarock via packer and see if it works? Penlight is a good example, you can do use_rocks {'penlight'} and then try and require it (please check the docs for how to use it) and see if it loads at all.

@amitkot
Copy link
Author

amitkot commented May 29, 2022

I tried, but it does not work on my system.
Adding use_rocks {'penlight'} and running PackerSync does not install an additional package, and running :lua require 'pl' does not find it.
I saw that there is a known issue that you opened some time ago on packer which might be related:
wbthomason/packer.nvim#180
but the suggested solution involving adding an environment variable (MACOSX_DEPLOYMENT_TARGET) did not change the behavior on my system.

@fitrh
Copy link

fitrh commented Sep 12, 2022

Had the same problem when trying this plugin and come across this issue, I used the following specification to solve the problem

use({
  "akinsho/pubspec-assist.nvim",
  requires = { "nvim-lua/plenary.nvim", module = "plenary" },
  config = function()
    require("pubspec-assist").setup()
  end,
  rocks = {
    "penlight",
    "ldoc",
    { "lyaml", server = "http://rocks.moonscript.org" },
  },
  event = { "BufRead pubspec.yaml" },
})

@akinsho
Copy link
Owner

akinsho commented Sep 12, 2022

ldoc and penlight are definitely not requirements for this plugin not sure if lyaml requires them, but I don't have that in my setup, and it works fine. Other than the addition of those rocks, the setup above doesn't differ much from the README.

I'm going to close this out since the original issue was due to a bug in packer I fixed a while ago.

@akinsho akinsho closed this as completed Sep 12, 2022
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

3 participants