How to install appium drivers programmatically in Nodejs


I have an electron app with package.json like this:

“dependencies”: {
“appium”: “^2.0.1”,


I am requiring “appium” lib and creating an appium instance. But I can not find any docs how to install drivers using appium instance.

const appium = require(‘appium’);
appium.installDriver(DriverName) → This is what I want to do

How can I install XCTest and UIA2 by using appium instance (not from terminal) in NodeJS ?


I don’t want to add drivers to my package.json. I just want to install drivers programmatically