iamcco / markdown-preview.nvim

markdown preview plugin for (neo)vim
MIT License
6.82k stars 284 forks source link

nodejs error running markdown-preview #582

Open Zeioth opened 1 year ago

Zeioth commented 1 year ago

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):

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'
  ]
}  
aretrosen commented 1 year ago

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.

jsr-p commented 1 year ago

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,
    },
System3-2 commented 1 year ago
    I have the same issue on an arch linux using `lazy.nvim` it didn't work for me
System3-2 commented 1 year ago

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.