markdown-preview.nvim icon indicating copy to clipboard operation
markdown-preview.nvim copied to clipboard

nodejs error running markdown-preview

Open Zeioth opened this issue 2 years ago • 4 comments
trafficstars

Describe the bug Fails to run all commands with an error.

To Reproduce Steps to reproduce the behavior:

  1. Download lazyvim config, of any other nvim config that uses lazy.
  2. Paste this on plugins.
  --  [markdown previewer]
  --  https://github.com/iamcco/markdown-preview.nvim
  {
    "iamcco/markdown-preview.nvim",
    event = "BufRead",
    cmd = {
      "MarkdownPreview", "MarkdownPreviewStop", "MarkdownPreviewToggle"
    },
    build = function()
      vim.fn["mkdp#util#install"]()
    end,
  },

Desktop (please complete the following information):

  • OS: Arch linux

Log:

 index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
    at Function.Module._load (node:internal/modules/cjs/loader:871:27)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object.<anonymous> (/home/zeioth/.local/share/nvim/lazy/markdown-preview.nvim/a
pp/lib/app/index.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Module.require (node:internal/modules/cjs/loader:1098:19) {    
  code: 'MODULE_NOT_FOUND',                                           
  requireStack: [                                                     
    '/home/zeioth/.local/share/nvim/lazy/markdown-preview.nvim/app/lib/app/index.js',
    '/home/zeioth/.local/share/nvim/lazy/markdown-preview.nvim/app/index.js'
  ]
}  

Zeioth avatar May 23 '23 00:05 Zeioth

I use Node v20.2.0 in an Arch machine, and I had the same problem. This is the snippet I used

  {
    "iamcco/markdown-preview.nvim",
    build = "pnpm up && cd app && pnpm install",
    init = function()
      vim.g.mkdp_filetypes = { "markdown" }
    end,
    ft = { "markdown" },
  },

This will now work. The problem is, since this repo has not been updated for quite some time, and now you have to update the library versions before you use this plugin. I use pnpm, something similar should apply for npm as well.

aretrosen avatar Jun 03 '23 17:06 aretrosen

The snippet below worked for me, using lazy.nvim, after reinstalling markdown-preview (by highlighting it out, pressing clean inside :Lazy menu and then reinstalling it):

    {
        "iamcco/markdown-preview.nvim",
        init = function()
            vim.g.mkdp_filetypes = { "markdown" }
        end,
        ft = { "markdown" },
        cmd = {
            "MarkdownPreview", "MarkdownPreviewStop", "MarkdownPreviewToggle"
        },
        event = "BufRead",
        build = function()
            vim.fn["mkdp#util#install"]()
        end,
    },

jsr-p avatar Jun 04 '23 11:06 jsr-p

    I have the same issue on an arch linux using `lazy.nvim` it didn't work for me

System3-2 avatar Jun 19 '23 17:06 System3-2

I use Node v20.2.0 in an Arch machine, and I had the same problem. This is the snippet I used

  {
    "iamcco/markdown-preview.nvim",
    build = "pnpm up && cd app && pnpm install",
    init = function()
      vim.g.mkdp_filetypes = { "markdown" }
    end,
    ft = { "markdown" },
  },

This will now work. The problem is, since this repo has not been updated for quite some time, and now you have to update the library versions before you use this plugin. I use pnpm, something similar should apply for npm as well.

System3-2 avatar Jun 19 '23 17:06 System3-2