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

[BUG] markmap-cli failing in node v16.20.1 #197

Closed
Zeioth opened this issue Jul 25, 2023 · 2 comments
Closed

[BUG] markmap-cli failing in node v16.20.1 #197

Zeioth opened this issue Jul 25, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Zeioth
Copy link

Zeioth commented Jul 25, 2023

Describe the bug

It used to work fine, but it doesn't now:

markmap -o /tmp/markmap.html /home/zeioth/myfile.md                                                                                                     

node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[AggregateError: All promises were rejected] {
  [errors]: [
    ReferenceError: fetch is not defined
        at /home/zeioth/.config/yarn/global/node_modules/markmap-common/dist/index.js:31:19
        at Array.map (<anonymous>)
        at UrlBuilder.getFastestProvider (/home/zeioth/.config/yarn/global/node_modules/markmap-common/dist/index.js:30:55)
        at UrlBuilder.findFastestProvider (/home/zeioth/.config/yarn/global/node_modules/markmap-common/dist/index.js:40:32)
        at createMarkmap (file:///home/zeioth/.config/yarn/global/node_modules/markmap-cli/dist/index.js:321:34)
        at Command.<anonymous> (file:///home/zeioth/.config/yarn/global/node_modules/markmap-cli/dist/index.js:367:13),
    ReferenceError: fetch is not defined
        at /home/zeioth/.config/yarn/global/node_modules/markmap-common/dist/index.js:31:19
        at Array.map (<anonymous>)
        at UrlBuilder.getFastestProvider (/home/zeioth/.config/yarn/global/node_modules/markmap-common/dist/index.js:30:55)
        at UrlBuilder.findFastestProvider (/home/zeioth/.config/yarn/global/node_modules/markmap-common/dist/index.js:40:32)
        at createMarkmap (file:///home/zeioth/.config/yarn/global/node_modules/markmap-cli/dist/index.js:321:34)
        at Command.<anonymous> (file:///home/zeioth/.config/yarn/global/node_modules/markmap-cli/dist/index.js:367:13)
  ]
}

To Reproduce

on node v16.20.1 run markmap -o /tmp/markmap.html ~/myfile.md

Expected behavior

A html file is generated in /tmp/markmap.html

Actual behavior

An error is displayed and the file is not created.

screenshot_2023-07-25_19-39-12_544826531

Environment:

  • OS: arch
  • Browser: Firefox 115.0.2

Additional context

The -w flag seems to at least open the html in the browser though.

my markmap version is 0.15.2 but it also hapen with 0.14, so the cause is probably a new node version.

@Zeioth Zeioth added the bug Something isn't working label Jul 25, 2023
@Zeioth Zeioth changed the title Bug: markmap-cli failing in node v16.20.1 [BUG]: markmap-cli failing in node v16.20.1 Jul 25, 2023
@Zeioth Zeioth changed the title [BUG]: markmap-cli failing in node v16.20.1 [BUG] markmap-cli failing in node v16.20.1 Jul 25, 2023
@gera2ld
Copy link
Member

gera2ld commented Jul 26, 2023

Right, fetch is only available in Node.js >= 18. I'll fix it by ignoring the errors for Node 16.

@Zeioth
Copy link
Author

Zeioth commented Jul 27, 2023

I can confirm that fixed it. Thank you Gerald.

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

No branches or pull requests

2 participants