diff --git a/index.js b/index.js index 28ef8cc..7cd012e 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ const os = require('os'); const path = require('path'); +const { execSync } = require('child_process'); const pkg = require('./package'); module.exports = { @@ -10,7 +11,18 @@ module.exports = { let driverPath = path.resolve(__dirname, 'vendor', 'chromedriver'); if (os.platform() === 'win32') { driverPath = driverPath + '.exe'; + } else if (os.platform() === 'linux' && os.arch() === 'arm') { + // Special handling for making it easy on Raspberry Pis + try { + const potentialChromdriverPath = execSync('which chromedriver'); + if (potentialChromdriverPath !== undefined) { + return potentialChromdriverPath.toString().trim(); + } + } catch (e) { + // Just swallow + } + } else { + return driverPath; } - return driverPath; } }; diff --git a/install.js b/install.js index 3f2f89b..486e4db 100644 --- a/install.js +++ b/install.js @@ -123,6 +123,11 @@ async function download() { os.arch() + " since there's no official build" ); + if (os.platform() === 'linux' && os.arch() === 'arm') { + console.log( + 'You can try downloading Chromedriver using: sudo apt-get install chromium-chromedriver -y' + ); + } } } }