mr-pdf
mr-pdf copied to clipboard
Unexpected token '.'
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:
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.
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
Close the issue according to the @pankaj-pant solution. Thanks!
Re-open this issue. Benefits when considering Dockerize.