Skip to content

[BUG] Windows Arborist Crash on rollbackMoveBackRetiredUnchanged #4448

Open
@bolshoytoster

Description

@bolshoytoster

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm install can crash when realFolders.get(retireFolder) returns undefined in the following code:

[_rollbackMoveBackRetiredUnchanged] (er) {
const moves = this[_retiredPaths]
// flip the mapping around to go back
const realFolders = new Map(Object.entries(moves).map(([k, v]) => [v, k]))
const promises = Object.entries(this[_retiredUnchanged])
.map(([retireFolder, nodes]) => promiseAllRejectLate(nodes.map(node => {
const realFolder = realFolders.get(retireFolder)
const rel = relative(realFolder, node.path)
const fromPath = resolve(retireFolder, rel)
return this[_moveContents]({ ...node, path: fromPath }, node.path)
})))
return promiseAllRejectLate(promises)
.then(() => this[_rollbackCreateSparseTree](er))
}

Also see log ~line 3459.

Expected Behavior

It shouldn't crash.

Steps To Reproduce

I'm not entirely sure, since I haven't experienced this error. This person has though.

Environment

  • npm: v8.4.1
  • Node.js: v17.5.0
  • OS Name: Windows_NT 10.0.22557
  • System Model Name: Don't know
  • npm config: Don't know

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 8.xwork is associated with a specific npm 8 releasews:arboristRelated to the arborist workspace

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions