diff options
Diffstat (limited to 'deps/npm/lib/npm.js')
-rw-r--r-- | deps/npm/lib/npm.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index 66111cab89a..b116ec5cc68 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -112,6 +112,7 @@ class Npm extends EventEmitter { // this is async but we dont await it, since its ok if it doesnt // finish before the command finishes running. it uses command and argv // so it must be initiated here, after the command name is set + // eslint-disable-next-line promise/catch-or-return updateNotifier(this).then((msg) => (this.updateNotification = msg)) // Options are prefixed by a hyphen-minus (-, \u2d). @@ -173,16 +174,15 @@ class Npm extends EventEmitter { async load () { if (!this.#loadPromise) { - this.#loadPromise = this.time('npm:load', () => this[_load]().catch(er => er).then((er) => { - this.loadErr = er - if (!er) { - if (this.config.get('force')) { - log.warn('using --force', 'Recommended protections disabled.') - } - } else { + this.#loadPromise = this.time('npm:load', async () => { + await this[_load]().catch((er) => { + this.loadErr = er throw er + }) + if (this.config.get('force')) { + log.warn('using --force', 'Recommended protections disabled.') } - })) + }) } return this.#loadPromise } @@ -229,7 +229,9 @@ class Npm extends EventEmitter { const node = this.time('npm:load:whichnode', () => { try { return which.sync(process.argv[0]) - } catch {} // TODO should we throw here? + } catch { + // TODO should we throw here? + } }) if (node && node.toUpperCase() !== process.execPath.toUpperCase()) { |