MCPcopy Index your code
hub / github.com/nodejs/node / exec

Method exec

deps/npm/lib/commands/doctor.js:106–133  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

104 .join('] [')}]`]
105
106 async exec (args) {
107 log.info('doctor', 'Running checkup')
108 let allOk = true
109
110 const actions = this.actions(args)
111
112 const chalk = this.npm.chalk
113 for (const { title, cmd } of actions) {
114 this.output(title)
115 // TODO when we have an in progress indicator that could go here
116 let result
117 try {
118 result = await this[cmd]()
119 this.output(`${chalk.green('Ok')}${result ? `\n${result}` : ''}\n`)
120 } catch (err) {
121 allOk = false
122 this.output(`${chalk.red('Not ok')}\n${chalk.cyan(err)}\n`)
123 }
124 }
125
126 if (!allOk) {
127 if (this.npm.silent) {
128 throw new Error('Some problems found. Check logs or disable silent mode for recommendations.')
129 } else {
130 throw new Error('Some problems found. See above for recommendations.')
131 }
132 }
133 }
134
135 async checkPing () {
136 log.info('doctor', 'Pinging registry')

Callers

nothing calls this directly

Calls 5

actionsMethod · 0.95
outputMethod · 0.95
infoMethod · 0.80
greenMethod · 0.45
redMethod · 0.45

Tested by

no test coverage detected