diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b9af464a059e..26cdad6c76383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ Unix systems. * [`235e5d6df`](https://github.com/npm/cli/commit/235e5d6df6f427585ec58425f1f3339d08f39d8a) ensure correct owner on cached all-packages metadata ([@isaacs](https://github.com/isaacs)) +* [`fa6acd2ea`](https://github.com/npm/cli/commit/fa6acd2ea035bf26c04d7885b534d03d5b77e7ba) + [npm.community#8450](https://npm.community/t/npm-audit-fails-with-child-requires-fails-because-requires-must-be-an-object/8540) + audit: report server error on failure ([@isaacs](https://github.com/isaacs)) ### DEPENDENCIES diff --git a/lib/audit.js b/lib/audit.js index 37b54d6eca140..c86566403a2bf 100644 --- a/lib/audit.js +++ b/lib/audit.js @@ -196,7 +196,10 @@ function auditCmd (args, cb) { } else if (err.statusCode === 404) { msg = `Your configured registry (${opts.registry}) does not support audit requests.` } else { - msg = `Your configured registry (${opts.registry}) does not support audit requests, or the audit endpoint is temporarily unavailable.` + msg = `Your configured registry (${opts.registry}) may not support audit requests, or the audit endpoint may be temporarily unavailable.` + } + if (err.body.length) { + msg += '\nThe server said: ' + err.body } const ne = new Error(msg) ne.code = 'ENOAUDIT'