fix: npm outdated parsing invalid specs · npm/cli@9981211 (original) (raw)

Original file line number Diff line number Diff line change
@@ -138,8 +138,11 @@ async function outdated_ (tree, deps, opts) {
138 138 const packument = await getPackument(spec)
139 139 const expected = edge.spec
140 140 // if it's not a range, version, or tag, skip it
141 -/* istanbul ignore next */
142 -if (!npa(`${edge.name}@${edge.spec}`).registry) {
141 +try {
142 +if (!npa(`${edge.name}@${edge.spec}`).registry) {
143 +return null
144 +}
145 +} catch (err) {
143 146 return null
144 147 }
145 148 const wanted = pickManifest(packument, expected, npm.flatOptions)
@@ -170,7 +173,7 @@ async function outdated_ (tree, deps, opts) {
170 173 err.code === 'E403' |
171 174 err.code === 'E404')
172 175 ) {
173 -throw (err)
176 +throw err
174 177 }
175 178 }
176 179 }