File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -156,10 +156,12 @@ export class NodePackageManager implements INodePackageManager {
156156 } ) ;
157157
158158 // Npm 5 return different object after performing `npm install --dry-run`.
159- // Considering that the dependency is already installed we should
160- // find it in the `updated` key as a first element of the array.
159+ // We find the correct dependency by searching for the `userSpecifiedPackageName` in the
160+ // `npm5Output.updated` array and as a fallback, considering that the dependency is already installed,
161+ // we find it as the first element.
161162 if ( ! name && npm5Output . updated ) {
162- const updatedDependency = npm5Output . updated [ 0 ] ;
163+ const packageNameWithoutVersion = userSpecifiedPackageName . split ( '@' ) [ 0 ] ;
164+ const updatedDependency = _ . find ( npm5Output . updated , [ 'name' , packageNameWithoutVersion ] ) || npm5Output . updated [ 0 ] ;
163165 return {
164166 name : updatedDependency . name ,
165167 originalOutput,
You can’t perform that action at this time.
0 commit comments