elliotblackburn / mdpdf

Markdown to PDF command line app with support for stylesheets
https://npmjs.com/package/mdpdf
Apache License 2.0
717 stars 47 forks source link

Can't run after fresh install on Ubuntu 22.04 #144

Closed info-git closed 2 years ago

info-git commented 2 years ago

Installed with npm install mdpdf -g

$ mdpdf

/usr/local/lib/node_modules/mdpdf/src/index.js:174
      await page.goto('file:' + tempHtmlPath, { waitUntil: options.waitUntil ?? 'networkidle0' });
                                                                              ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/mdpdf/bin/index.js:7:15)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
elliotblackburn commented 2 years ago

Hi there, what version of nodejs and npm are you running? This looks to me like your version of node might be old.

info-git commented 2 years ago

Hello Yeah that might be it

$ npm --version
8.5.1
$ nodejs --version
v12.22.9

I'm gonna try and see if there's upgrade instructions I can use

info-git commented 2 years ago

OK. Got it working by following the instructions for the NVM method @ https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04 Working version of node is v16.14.0

elliotblackburn commented 2 years ago

Glad you got it sorted, v8 is a very old version so it's no surprise it doesn't like some more recent syntax. We currently support v14, v16, and v18 so any of those should be fine.