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

Trouble Bootstrapping Packer on MacOS: ENAMETOOLONG #1214

Open
Caylub opened this issue Feb 20, 2023 · 0 comments
Open

Trouble Bootstrapping Packer on MacOS: ENAMETOOLONG #1214

Caylub opened this issue Feb 20, 2023 · 0 comments
Labels
bug v1 An issue or PR relevant to packer v2

Comments

@Caylub
Copy link

Caylub commented Feb 20, 2023

  • nvim --version:
    • 8.0 - 9.0
  • git --version:
    • 2.39.2
  • Operating system/version: MacOS
    • ProductName: macOS
    • ProductVersion: 12.6.3
    • BuildVersion: 21G419
  • Terminal name/version:
    • Alacritty
      • 0.11.0 (8dbaa0b)

Steps to reproduce

Attempting to bootstrap on MacOS, using an up to date packer configuration that I have working on multiple other machines (Linux machines).

Actual behaviour

I install neovim, either from brew install neovim or installing from source, and the result of attempting to bootstrap is a wall of red text stating:

[packer.nvim] [ERROR 18:26:06] jobs.lua:83: Failed spawning command: git because ENAMETOOLONG: name too long

After outright failing to use my configuration, I deleted everything and started from scratch using the currently recommended bootstrapping code from the packer github page. Same issue, same message as above "... name too long".

Expected behaviour

On all other machines with this configuration, I can either enter my pluings, save and have packer bootstrap, or initiate bootstrapping, executing nvim headless from the terminal.

packer files

-- bootstraping packer plugin manager
local install_path = vim.fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
  is_bootstrap =  true
  vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
  vim.cmd [[packadd packer.nvim]]
end

-- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer")
if not status_ok then
  return
end

-- Have packer use a popup window
packer.init {
  display = {
    open_fn = function()
      return require("packer.util").float { border = "rounded" }
    end,
  },
}

-- Autocommand that reloads neovim whenever you save the plugins.lua file
vim.cmd [[
  augroup packer_user_config
    autocmd!
    autocmd BufWritePost plugins.lua source <afile> | PackerSync
  augroup end
]]

-- plugins
require('packer').startup(function(use)
  -- Packer manager
  use { 'wbthomason/packer.nvim' }

  -- tpope plugins
  use { 'tpope/vim-surround' } -- adds support for surrounding & removing text with characters
  use { 'tpope/vim-fugitive' } -- adds support for running git commints with `G` within neovim
  use { 'tpope/vim-repeat' } -- adds support for selecting words and inserting brackets around them
  use { 'tpope/vim-sleuth' } -- Detect tabstop and shiftwidth automatically

  -- utilities
  use { 'akinsho/nvim-toggleterm.lua' } -- floating/embedded terminal
  use { 'numToStr/comment.nvim', -- a commenter that supports tree sitter and embedded comments:w
    config = function()
      require('Comment').setup({
        toggler = {
          line = '<leader>cc',
          block = '<leader>ccb',
        },
        opleader = {
          line = '<leader>c',
          block = '<leader>b'
        },
        extra = {
          above = '<leader>cO',
          below = '<leader>co',
          eol = '<leader>cA',
        },
        mappings = {
          basic = true,
          extra = true,
        }
      })
    end
  }
  use { 'lewis6991/impatient.nvim' } -- reduces the load time of nvim (by lazy loading I think)
  use { 'lewis6991/gitsigns.nvim' } -- reduces the load time of nvim (by lazy loading I think)
  use { 'windwp/nvim-autopairs' } -- an app that helps insert all kinds of pairs (), [], {}, etc
  use { 'ThePrimeagen/harpoon' } -- an app that allows quick switching between harpooned files
  use { 'mbbill/undotree' } -- a pluing that facilitates visualizing & applying a tree of undo states
  use { 'ibhagwan/smartyank.nvim' }  -- a plugin to modernize yanking and pasting
  use { 'famiu/nvim-reload' }
  use { 'ibhagwan/fzf-lua',
    -- optional for icon support
    requires = { 'nvim-tree/nvim-web-devicons' }
  }
  use { 'smjonas/inc-rename.nvim',
    config = function()
      require('inc_rename').setup()
    end,
  }

  -- "project wide" highlighting on `TODO`,  `FIX`, `PERF`, `NOTE`, `WARNING`, `HACK`
  use {
    'folke/todo-comments.nvim',
    requires = 'nvim-lua/plenary.nvim',
    config = function()
      require('todo-comments').setup {
        -- your configuration comes here
        -- or leave it empty to use the default settings
        -- refer to the configuration section below
      }
    end
  }

-- "project-wide" interface for viewing all the errors in the current file
use {
  'folke/trouble.nvim',
  requires = 'kyazdani42/nvim-web-devicons',
  config = function()
    require('trouble').setup {
      -- your configuration comes here
      -- or leave it empty to use the default settings
      -- refer to the configuration section below
    }
  end
}
  -- fuzzy search UI
  use { 'nvim-telescope/telescope.nvim', branch = '0.1.x',requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}}
  use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 }
  -- use { 'nvim-telescope/telescope-media-files.nvim', cmd = 'Telescope' }

  -- Highlight, edit, and navigate code
  use { 'nvim-treesitter/nvim-treesitter',
    run = function()
      pcall(require('nvim-treesitter.install').update { with_sync = true })
    end,
  }
  -- Additional text objects via treesitter
  use { 'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'}

  -- navigation plugins
  use { 'ggandor/leap.nvim', commit = 'a9d3232b178fddabb6660dc19abf40e05d6841b0' }

  -- file navigation
  use {
    'kyazdani42/nvim-tree.lua',
    --commit = 'cdb40dc42e5521367b9b1c40b8683331cf3500d7',
    --requires = 'kyazdani42/nvim-web-devicons',
    --config = function() require'nvim-tree'.setup {} end
  }

  -- cmp plugins
  use { -- Autocompletion
    'hrsh7th/nvim-cmp',
    requires = {
            'hrsh7th/cmp-nvim-lsp',
            'L3MON4D3/LuaSnip',
            'saadparwaiz1/cmp_luasnip',
            'rafamadriz/friendly-snippets',
            'hrsh7th/cmp-nvim-lsp-signature-help',
            'hrsh7th/cmp-buffer',
            'hrsh7th/cmp-path',
            'hrsh7th/cmp-nvim-lua'
    },
  }

  -- LSP installation
  use { -- LSP Configuration & Plugins
    'neovim/nvim-lspconfig',
    requires = {
      -- Automatically install LSPs to stdpath for neovim
      'williamboman/mason.nvim',
      'williamboman/mason-lspconfig.nvim',

      -- Useful status updates for LSP
      'j-hui/fidget.nvim',

      -- Additional lua configuration, makes nvim stuff amazing
      'folke/neodev.nvim',
    },
  }
  --use { 'jose-elias-alvarez/null-ls.nvim' }

  -- colors & themes & icons
  use { 'onsails/lspkind.nvim' }
  use { 'navarasu/onedark.nvim' }
  use { 'nvim-lualine/lualine.nvim' }
  use { 'lukas-reineke/indent-blankline.nvim' } -- Add indentation guides even on blank lines

  -- Markdown preview
  use { 'iamcco/markdown-preview.nvim',
    run = 'cd app && npm install',
    setup = function() vim.g.mkdp_filetypes = { 'markdown' } end,
    ft = { 'markdown' },
  }

  -- DAP Plugins
  -- use { 'nvim-lua/plenary.nvim' }
  -- use { 'mfussenegger/nvim-dap' }
  -- use {
  --   "rcarriga/nvim-dap-ui",
  --  --commit = "a861906c8d1c457965c64ce6e83ea5e930bf8fd1",
  --  requires = { "mfussenegger/nvim-dap" }
  -- }

  ----------------------------------------------------------------------
  -- Language Specific Plugins --
  ----------------------------------------------------------------------
  -- Java plugins
  -- use {'mfussenegger/nvim-jdtls'}

  -- Rust
   use { 'simrat39/rust-tools.nvim' }

  -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua
  -- local has_plugins, plugins = pcall(require, 'custom.plugins')
  -- if has_plugins then
  --   plugins(use)
  -- end

  if is_bootstrap then
    require('packer').sync()
  end
end)

-- You'll need to restart nvim, and then it will work.
if is_bootstrap then
  print '=================================='
  print '    Plugins are being installed'
  print '    Wait until Packer completes,'
  print '       then restart nvim'
  print '=================================='
  return
end

Post the contents of ~/.cache/nvim/packer.nvim.log here

There's no packer.nvim.log, since I imagine the installation and bootstrapping process doesn't get that far. However, I do see that the git command that is called out as being too long, at least does pull some/all? of packer into the ~/.local/share/.../start/packer.nvim folder.

Post the contents of packer_compiled.vim here
packer_compiled.lua:

-- Automatically generated packer.nvim plugin loader code

if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
  vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
  return
end

vim.api.nvim_command('packadd packer.nvim')

local no_errors, error_msg = pcall(function()

_G._packer = _G._packer or {}
_G._packer.inside_compile = true

local time
local profile_info
local should_profile = false
if should_profile then
  local hrtime = vim.loop.hrtime
  profile_info = {}
  time = function(chunk, start)
    if start then
      profile_info[chunk] = hrtime()
    else
      profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
    end
  end
else
  time = function(chunk, start) end
end

local function save_profiles(threshold)
  local sorted_times = {}
  for chunk_name, time_taken in pairs(profile_info) do
    sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
  end
  table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
  local results = {}
  for i, elem in ipairs(sorted_times) do
    if not threshold or threshold and elem[2] > threshold then
      results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
    end
  end
  if threshold then
    table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
  end

  _G._packer.profile_output = results
end

time([[Luarocks path setup]], true)
local package_path_str = "/Users/kecaleb/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/kecaleb/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/kecaleb/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/kecaleb/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/kecaleb/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
  package.path = package.path .. ';' .. package_path_str
end

if not string.find(package.cpath, install_cpath_pattern, 1, true) then
  package.cpath = package.cpath .. ';' .. install_cpath_pattern
end

time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
  local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
  if not success then
    vim.schedule(function()
      vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
    end)
  end
  return result
end

time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
  ["packer.nvim"] = {
    loaded = true,
    path = "/Users/kecaleb/.local/share/nvim/site/pack/packer/start/packer.nvim",
    url = "https://github.com/wbthomason/packer.nvim"
  }
}

time([[Defining packer_plugins]], false)

_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
  vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false

if should_profile then save_profiles() end

end)

if not no_errors then
  error_msg = error_msg:gsub('"', '\\"')
  vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end
@Caylub Caylub added bug v1 An issue or PR relevant to packer v2 labels Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v1 An issue or PR relevant to packer v2
Projects
None yet
Development

No branches or pull requests

1 participant