fraserxu / electron-pdf

📄 A command line tool to generate PDF from URL, HTML or Markdown files.
MIT License
1.23k stars 136 forks source link

How to install on Mac ? #175

Open bilashcse opened 7 years ago

bilashcse commented 7 years ago

I want to install electron-pdf on mac. How can I do this ?

codecounselor commented 7 years ago

The readme explains the usage in pretty good detail. I suggest you read that first and then comment here again if you have issues using the CLI.

bilashcse commented 7 years ago

I have read the doc already & worked on Linux successfully. But Now need to install this on mac os. What will be the alternative solution for :

For gnu/linux installations without a graphical environment: $ sudo apt-get install xvfb # or equivalent $ export DISPLAY=':99.0' $ Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & $ electron-pdf ...

codecounselor commented 7 years ago

It should be exactly the same (npm install -g electron-pdf), minus the display. There was one other mac related ticket https://github.com/fraserxu/electron-pdf/issues/126 but I have never been able to reproduce that error.

bilashcse commented 7 years ago

I have installed electron-pdf but what will be the alternative solution for

For gnu/linux installations without a graphical environment: $ sudo apt-get install xvfb # or equivalent $ export DISPLAY=':99.0' $ Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & $ electron-pdf ...

bilashcse commented 7 years ago

And after install electron-pdf on mac, when just write electron-pdf & hit enter error occurred:

/usr/local/lib/node_modules/electron-pdf/node_modules/electron/index.js:9 throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again') ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again at Object. (/usr/local/lib/node_modules/electron-pdf/node_modules/electron/index.js:9:9) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (/usr/local/lib/node_modules/electron-pdf/cli.js:4:20) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10)

fraserxu commented 7 years ago

From the error you might have an error while downloading electron(which is not a small file), can you try to run install it again? It may fix the issue as this is a quite common error for people install electron.