function packageExists(packageName) {
    try {
        require(packageName);
        return true;
    } catch (err) {
        return false;
    }
}

module.exports = packageExists;

function packageExists(packageName) {
    try {
        require.resolve(packageName);
        return true;
    } catch (err) {
        return false;
    }
}

module.exports = packageExists;

improve package-exists util (#2067)