-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
cliui git dependency breaks lerna installation #4
Comments
Agreed - @richallanb beat me by an hour (nice!), but I think I'm getting reports of the same problem for the |
Not sure you need receipts, but here's some supporting evidence: node@7ed5037cb4c0:/home/workdir$ npm ls cliui
workdir@ /home/workdir
`-- markdownlint-cli@0.34.0
`-- glob@10.2.2
`-- jackspeak@2.1.4
`-- cliui@8.0.1 (git+ssh://git@github.com/isaacs/cliui.git#9f97090165675fdda63a79c29bc36bb1033506b0) npm http fetch GET 200 https://registry.npmjs.org/color-name 44ms (cache revalidated)
npm http fetch GET 200 https://codeload.github.com/isaacs/cliui/tar.gz/9f97090165675fdda63a79c29bc36bb1033506b0 445ms (cache revalidated)
npm verb stack Error: git dep preparation failed
npm verb stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) |
I can roll it back, but what's the problem with git deps? npm has supported git deps for ages, I've used them in published packages lots of times. |
I'll just publish it as a normal npm fork for now I guess. But cliui failing prepare seems like an npm bug to me. |
@isaacs Yeah I think you're right. This actually worked perfectly fine in npm 6. |
It seems there is a circular dependencies between I started having this issue with |
@6XGate one issue is enough, no need to repost this on everything that uses glob. (Everything uses glob, you'll be busy for some time.) |
But yes, the cycle is what I was missing. It can't build cliui without rimraf, which needs glob, which needs jackspeak, which needs cliui, so it tries to run the prepare before it has what it needs. |
It's weird you can install cliui without issue by itself. |
That's because cyclical deps are normally fine, npm handles them no problem. And in fact, they're usually fine when installing deps from git, as well. Because a git repository typically doesn't have built artifacts, in order to install a git dep, npm has to do a little bit of extra work. It clones the repo, installs its dev dependencies, and then runs the Unfortunately, in this case, cliui depends on rimraf, and uses the rimraf bin in its prepare script. Rimraf depends on glob, which depends on jackspeak, which depends on that same git version of cliui. npm usually is fairly clever about building dependencies before their dependents. However, once it encounters a cycle, it has to pick something, and the algorithm it uses it "upon a cycle, don't continue to recurse, just hope for the best". It's easy to see with our human brains that if it had chosen to build rimraf prior to building cliui, it would have worked, but what if rimraf had required glob to do its build? Then choosing to build rimraf first would have failed in the same way. Bootstrap problems are tricky. Anyway, published a new jackspeak that depends on |
Thanks for fixing; fyi the use of aliases also is still breaking installation of my dev dep that's pulling this in. |
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
… a `glob` that breaks CI See isaacs/jackspeak#4
… a `glob` that breaks CI See isaacs/jackspeak#4
… kill the install process in npm < 6 See isaacs/jackspeak#4
…pectively depend on npm aliases, which kill the install process in npm < 6 See isaacs/jackspeak#4
…pectively depend on npm aliases, which kill the install process in npm < 6 See isaacs/jackspeak#4
It appears the introduction of cliui using a git path for the dependency has broken installing
lerna
onnpm
8 and 9.https://github.com/isaacs/jackspeak/blob/main/package.json#L70
Tested on node v16 and v18, with
npm
9.6.5 and 8.19.4The text was updated successfully, but these errors were encountered: