Skip to content

Link dependencies being mishandled when installing from git #3918

Closed
@isaacs

Description

@isaacs

(Continuing from #3123, as the current issues in the referenced reproduction case are a different problem.)

Re: https://github.com/ioBroker/ioBroker.js-controller

Running this command:

npm i ioBroker/ioBroker.js-controller

in an empty project raises several issues related to Link deps that don't have targets at the time that rebuild and calcDepFlags are run. It seems like this is a simple matter of adding some checks in Arborist to guard against a Link node that doesn't have a target. (Alternatively, we need to make Link objects have a fallback so that link.target will refer to the link itself, like it does for Node objects. If we go that route, we have some node.isLink checks which then recurse to the node.target and will cause infinite loops, so that will have to be guarded against instead. Not sure offhand which is the less complex/dangerous approach.)

Once the checks are added, however, the story gets even more interesting.

Running npm i ioBroker/ioBroker.js-controller seems to work. Running npm i ioBroker/ioBroker.js-controller a second time, works again. Running npm i ioBroker/ioBroker.js-controller a third time fails horribly, with many packages not being found.

My suspicion is that this is related to the issue highlighted in npm/arborist#299, where lifecycle scripts of locally linked dependencies are not run on first install.

Posted here because I'm not 100% sure this is an Arborist issue, but once it has been root caused, it seems like a good idea to post an issue over on https://github.com/npm/arborist with a more in-the-weeds description and fix.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 8.xwork is associated with a specific npm 8 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions