From 45c72f0c2830319cca97e2230e412f096bec8103 Mon Sep 17 00:00:00 2001 From: Jonas Hermsmeier Date: Thu, 18 Jan 2018 09:11:46 -0800 Subject: [PATCH] fix(usb): Ignore errors if winusb doesn't load (#1970) Due to some Windows systems missing certain C runtime libraries (Visual C/C++ 2012 / 2015 Redistributables), we ignore errors when loading this module until we can ensure distribution of those along with it. Change-Type: patch Changelog-Entry: Fix "The specified module could not be found" on Windows Fixes #1956 --- lib/shared/sdk/usbboot/usb.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/shared/sdk/usbboot/usb.js b/lib/shared/sdk/usbboot/usb.js index d0e2d98f..6e3bc98f 100644 --- a/lib/shared/sdk/usbboot/usb.js +++ b/lib/shared/sdk/usbboot/usb.js @@ -74,15 +74,22 @@ exports.listDevices = () => { // Include driverless devices into the list of USB devices. if (process.platform === 'win32') { - const winusbDriverGenerator = require('winusb-driver-generator') - for (const device of winusbDriverGenerator.listDriverlessDevices()) { - devices.push({ - accessible: false, - deviceDescriptor: { - idVendor: device.vid, - idProduct: device.pid - } - }) + // NOTE: Temporarily ignore errors when loading winusb-driver-generator, + // due to C Runtime issues on Windows; + // see https://github.com/resin-io/etcher/issues/1956 + try { + const winusbDriverGenerator = require('winusb-driver-generator') + for (const device of winusbDriverGenerator.listDriverlessDevices()) { + devices.push({ + accessible: false, + deviceDescriptor: { + idVendor: device.vid, + idProduct: device.pid + } + }) + } + } catch (error) { + // Ignore error } }