This is anything but straightforward and I am still not convinced I have nailed it having tried so many different things. However, I am now getting a list of printers after 2 days of frustration...something that took 10 minutes to work out in NW.js (just sayin)

With that disclaimer these are the steps I believe need to be taken.

  1. If you are not on node v4.7.0 then update to that version ('node -v' to see what version you are on) [This may not be necessary for you but it was in my working environment]
  2. Install latest version of Python (v2.7.12 as of 17/12/2016) [https://www.python.org/downloads/release/python-2712/]
  3. Make sure you have the Windows 8.1 SDK installed and a version of Visual Studio, I used 2015
  4. Execute the following
    npm install node-printer --runtime=electron --target=1.4.2 --target_arch=x64
  5. Now you have to install and build 'printer' which is why you need items 2 and 3, so execute the following
    npm install -g node-gyp npm install printer --msvs_version=2015 --build-from-source=node_printer
  6. And just when you think you are done....you are not!
  7. Now you need to rebuild electron so it will work with the above. Execute the following
    npm install --save-dev electron-rebuild
  8. No you are not done yet, that just installed something to rebuild electron
  9. Now you are going to rebuild electron by executing
    .\node_modules\.bin\electron-rebuild.cmd
  10. This will take a while and you will get a bunch of warnings and it will probably end with an error...which is why I don't think I have nailed it and this will probably cause some other unknown issues.

On the bright side the following code ...

var printer = require("printer"), util = require('util'); var printers = printer.getPrinters();
... actually gives me a list of local printers now (big grin) and I am optimistic I will be able to print.

If I was a gambling man I would hazard a guess that the above minefield is probably why there is no print menu in Slack or VSCode