mr-pdf icon indicating copy to clipboard operation
mr-pdf copied to clipboard

Unexpected token '.'

Open captv89 opened this issue 3 years ago • 4 comments

OS: Windows 10

Running the example command for Docusaurus v2 fails with the message Unexpected token '.'

Command:

npx mr-pdf --initialDocURLs="https://docusaurus.io/docs/" --contentSelector="article" --paginationSelector=".pagination-nav__item--next > a" --excludeSelectors=".margin-vert--xl a" --coverImage="https://docusaurus.io/img/docusaurus.png" --coverTitle="Docusaurus v2"

Screenshot: image

captv89 avatar Jun 28 '21 18:06 captv89

I was having this issue on a Mac as well. For me the issue was happening due to the version of node that I was using. On node v12.22.1 this error was being generated. For work I need to switch between different version of node regularly, so I used nvm to change the node version to v14.17.0, and the pdf generated successfully. Hope this helps.

pankaj-pant avatar Jul 15 '21 07:07 pankaj-pant

Are you using NVM for windows? I experienced something similar with NPX and with the same error message (when installing docusaurus with npx).

What worked for me was to upgrade "NVM for windows" to the latest version. (https://github.com/coreybutler/nvm-windows)

Afterwards, you also have to reinstall the node version(s) causing problems, see: https://github.com/npm/cli/issues/4234#issuecomment-1275612483

BjarkeNL avatar Dec 09 '22 22:12 BjarkeNL

Close the issue according to the @pankaj-pant solution. Thanks!

kohheepeace avatar Jun 27 '23 17:06 kohheepeace

Re-open this issue. Benefits when considering Dockerize.

kohheepeace avatar Jun 30 '23 22:06 kohheepeace