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

Peek error: error: Module not found .../public/main.bundle.js #47

Closed
dasupradyumna opened this issue Jun 10, 2023 · 15 comments · Fixed by #50
Closed

Peek error: error: Module not found .../public/main.bundle.js #47

dasupradyumna opened this issue Jun 10, 2023 · 15 comments · Fixed by #50
Labels
bug Something isn't working

Comments

@dasupradyumna
Copy link

dasupradyumna commented Jun 10, 2023

Describe the bug
I have followed the instructions provided in the repository to install the plugin.

  • Installed deno binary from the website first
  • Installed the plugin using lazy.nvim package manager
  • The build part of the command deno task --quiet build:fast fails with an error:
error: Node specifiers have not yet been implemented for this subcommand (https://github.com/denoland/deno/issues/15960). Found: node:punycode

Steps To Reproduce

  1. Open NeoVim instance and a markdown file
  2. Execute :lua require('peek').open() command, which throws an error:
Peek error: error: Module not found "file:///home/kenja/.local/share/nvim/lazy/peek.nvim/public/main.bundle.js".

Expected behavior
A markdown preview should open when :lua require('peek').open() is executed

Desktop (please complete the following information):

  • OS: Ubuntu
  • nvim --version:
NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
  • deno --version:
deno 1.34.2 (release, x86_64-unknown-linux-gnu)
v8 11.5.150.2
typescript 5.0.4
  • plugin setup:
require('peek').setup()

Additional context
Similar issues were noted in #11, #28 and #46
Workarounds (manual installation) provided in these issues failed with the same error above error: Node specifiers ...

@dasupradyumna dasupradyumna added the bug Something isn't working label Jun 10, 2023
@sdrap
Copy link

sdrap commented Jun 10, 2023

Exactly the same environment and same problem. Did the same workarounds and got the same errors

@dasupradyumna dasupradyumna changed the title Peek error: error: Module not found Peek error: error: Module not found .../public/main.bundle.js Jun 10, 2023
@cloudsftp
Copy link

I have the exact same issue, but I installed it using Packer.

After playing around with different deno versions, I got a better error message (with deno v1.25.0):

error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead.
  Importing: node:punycode
    at https://esm.sh/v125/[email protected]/denonext/markdown-it.mjs:2:328

Only main.ts doesn't compile, the other targets are fine.

This is my first time working with deno so I don't really know how to fix this.
Maybe the installer script should use a different command to bundle src/main.ts since deno bundle is deprecated?

I tried building main.ts with esbuild app/src/main.ts --bundle --outdir=public, which then produces public/main.js.
So you have to also change the run command in deno.json.
This script then had a problem requiring some package dynamically.
Maybe this will help someone figure out a solution.

@cloudsftp
Copy link

I replaced the bundling process with deno_emit. This works nice.

I will replace all other bundlings with this also and open a PR. In the meantime you can try my version here: https://github.com/cloudsftp/peek.nvim/tree/bundle

@fengzhiken
Copy link

I am trying to use your version, @cloudsftp , I still get the same error. Am I doing something wrong?

image

@cloudsftp
Copy link

I am trying to use your version, @cloudsftp , I still get the same error. Am I doing something wrong?

@fengzhiken Unfortunately, my version only works with older versions of deno. Refer to the pull request, I linked.

@qizidog
Copy link

qizidog commented Jul 11, 2023

same problem, env as follow

❱❱❱ nvim --version
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

     系统 vimrc 文件: "$VIM/sysinit.vim"
         $VIM 预设值: "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim"

Run :checkhealth for more info
❱❱❱ deno --version
deno 1.34.3 (release, aarch64-apple-darwin)
v8 11.5.150.2
typescript 5.0.4

@GervinFung
Copy link

facing the same problem when I'm trying out this tool, in the meantime, I think u guys can try this markdown preview tool

@serginhohigh
Copy link

facing the same problem when I'm trying out this tool, in the meantime, I think u guys can try this markdown preview tool

This plugin is laggin with puml. Periodically raise strange exceptions when code is ok

@pabloqpacin
Copy link

Facing the same problem.

:PeekOpen returns:

Peek error: error: Module not found "file:///home/pabloqpacin/.local/share/nvim/site/pack/packer/s
tart/peek.nvim/public/main.bundle.js"."

Now this is the output for cd ~/.local/share/nvim/site/pack/packer/start/peek.nvim && deno task build:debug:

peek.nvim (master) » deno task build:debug ~/.local/share/nvim/site/pack/packer/start/peek.nvim
Task build:debug DEBUG=true deno task build
Task build deno run --allow-run --allow-net --allow-read --allow-write --allow-env --no-check scripts/build.js
┌─────────────────────────┬────────┬────────────────────────────┐
│ (idx)                   │ size   │ modified                   │
├─────────────────────────┼────────┼────────────────────────────┤
│ style.css               │   3344 │ "11/08/2023, 15:44:43.084" │
│ index.html              │    691 │ "11/08/2023, 15:44:43.084" │
│ webview.js              │ 291446 │ "11/08/2023, 15:44:43.220" │
│ github-markdown.min.css │  20677 │ "11/08/2023, 15:44:43.540" │
│ script.bundle.js        │  15840 │ "11/08/2023, 15:44:43.168" │
└─────────────────────────┴────────┴────────────────────────────┘
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
Warning "deno bundle" is deprecated and will be removed in the future.
Use alternative bundlers like "deno_emit", "esbuild" or "rollup" instead.
Warning "deno bundle" is deprecated and will be removed in the future.
Use alternative bundlers like "deno_emit", "esbuild" or "rollup" instead.
Warning "deno bundle" is deprecated and will be removed in the future.
Use alternative bundlers like "deno_emit", "esbuild" or "rollup" instead.
Download https://cdn.skypack.dev/-/@types/[email protected]/dist=es2019,mode=typ
Bundle file:///home/pabloqpacin/.local/share/nvim/site/pack/packer/start/peek.nvim/app/src/webview.ts
error: Node specifiers have not yet been implemented for this subcommand (https://github.com/denoland/deno/issues/15960). Found: node:punycode
Bundle file:///home/pabloqpacin/.local/share/nvim/site/pack/packer/start/peek.nvim/client/src/script.ts
Emit "public/script.bundle.js" (15.47KB)
┌─────────────────────────┬────────┬────────────────────────────┐
│ (idx)                   │ size   │ modified                   │
├─────────────────────────┼────────┼────────────────────────────┤
│ style.css               │   3344 │ "11/08/2023, 15:44:43.084" │
│ index.html              │    691 │ "11/08/2023, 15:44:43.084" │
│ webview.js              │ 291446 │ "11/08/2023, 15:47:02.870" │
│ github-markdown.min.css │  20677 │ "11/08/2023, 15:44:43.540" │
│ script.bundle.js        │  15840 │ "11/08/2023, 15:47:03.478" │
└─────────────────────────┴────────┴────────────────────────────┘

Notably, no peek.nvim/public/main.bundle.js file is created or available. A few months ago I got this up and running in both WSL_Ubuntu and Arch and loved it. Now however I'm running Pop!_OS and there seems to be no solution but either OS.

@wuliuqii
Copy link

Same problem in NixOS.

@pabloqpacin
Copy link

Can confirm the tweaks at #50 fix the issue 👍

@john-kenealy
Copy link

I had the same problem and implemented the four lines from the PR @pabloqpacin recommended. Ran a fresh deno task --quiet build and peek is now working as expected.

@inactdev
Copy link

inactdev commented Oct 4, 2023

Can also confirm that @pabloqpacin fix works ! Used @john-kenealy's comment above 👍

@bassamsdata
Copy link

I had this issue as well, but using @Saimo PR and then fresh deno build solve the issue.

@dasupradyumna
Copy link
Author

@toppair Could you please check the mentioned PR and merge it? There have been multiple confirmations already about the PR fixing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.