Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link dependencies being mishandled when installing from git #3918

Closed
isaacs opened this issue Oct 20, 2021 · 2 comments
Closed

Link dependencies being mishandled when installing from git #3918

isaacs opened this issue Oct 20, 2021 · 2 comments
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@isaacs
Copy link
Contributor

isaacs commented Oct 20, 2021

(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.

@darcyclarke darcyclarke added Bug thing that needs fixing Priority 1 high priority issue labels Dec 1, 2021
@darcyclarke darcyclarke added the Release 8.x work is associated with a specific npm 8 release label Jan 11, 2022
@nlf nlf self-assigned this Mar 24, 2022
@nlf
Copy link
Contributor

nlf commented Mar 24, 2022

can you try this on npm@8.5.5 and see if you're still experiencing the same problem? we made some changes to how git dependencies are handled. as things are right now, if i clone your repo and run npm install i get build errors that are unrelated to link targets (your build script in one of the packages is not being run before your install script)

the build problem might warrant a new issue being opened, but i'm wondering if the combination of npm workspaces + lerna is at play here. in any event, i do believe the git + workspaces problem has been solved, but please do let me know.

@nlf
Copy link
Contributor

nlf commented Apr 4, 2022

Closing due to age. If this is still a problem please feel free to reopen this issue, or create a new issue w/ steps to reproduce.

@nlf nlf closed this as completed Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

3 participants