Before you start the upgrade, make sure to upgrade to the latest available 3.5.x version. This will make sure that you are building against the most recent dependencies of that line. Please take time ...
Root Cause Analysis The BigInteger.prototype.modInverse (m) function in lib/jsbn.js implements the Extended Euclidean Algorithm to compute the modular multiplicative inverse of this modulo m.