purescript / spago

🍝 PureScript package manager and build tool
BSD 3-Clause "New" or "Revised" License
791 stars 132 forks source link

Failed to install dependency "xxx" #957

Closed Dev3124 closed 1 year ago

Dev3124 commented 1 year ago

When I am going to install a dependency, I am getting this error

$ spago repl
[info] Installing 32 dependencies.
[info] Installing "control"
[info] Installing "const"
[info] Installing "either"
[info] Installing "contravariant"
[info] Installing "distributive"
[info] Installing "bifunctors"
[info] Installing "foldable-traversable"
[info] Installing "console"
[info] Installing "arrays"
[info] Installing "functors"
[info] Installing "newtype"
[info] Installing "identity"
[info] Installing "exists"
[info] Installing "invariant"
[info] Installing "orders"
[info] Installing "lazy"
[info] Installing "nonempty"
[info] Installing "maybe"
[info] Installing "effect"
[info] Installing "lists"
[info] Installing "partial"
[info] Installing "prelude"
[info] Installing "profunctor"
[info] Installing "psci-support"
[info] Installing "safe-coerce"
[info] Installing "refs"
[info] Installing "st"
[info] Installing "tailrec"
[info] Installing "tuples"
[info] Installing "type-equality"
[info] Installing "unfoldable"
[info] Installing "unsafe-coerce"
[error]
Failed to install dependency "foldable-traversable"
Git output:

fatal: destination path '.' already exists and is not an empty directory.

Aborting installation..
[error]
Failed to install dependency "foldable-traversable"
Git output:

fatal: destination path '.' already exists and is not an empty directory.

Aborting installation..
[error] Installation failed
[error] Error:
[error] ExitFailure 1

I looked for some issues and documentation, but could not find the solution. I am using spago on wildows, I am not sure if the OS is the cause.

arrowd commented 1 year ago

The same is happening on FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272064

itdolmatov commented 1 year ago

I found, that error fatal: destination path '.' already exists and is not an empty directory. occurs in case if git not initialized.

I found, that "spago build" somehow calls git commands, because git icon in my VS Code changes during build. So, when i initialized git in a directory, the error went away.

Could anyone explain such behavior?

zvodd commented 1 year ago

I decided to try the out PureScript recently and immediately hit this roadblock. Still have no idea why, but at least I can actually try the language now, thanks to itdolmatov's comment.

Maybe a quick fix would be to have Spago initialise a git repo if .git folder is missing? Or could throw an informative error message that instructs users to initialise a git repository. This would really reduce friction.

f-f commented 1 year ago

We have Windows CI that shows that we can indeed install packages even if the folder is not a git repo. Spago has been rewritten in PureScript now - you can install it via npm install -g spago@next, so I wonder if you'd get the same error even with the new spago? I'll close this for now, let's reopen if we find out that the new Spago has the same issue.

RedGlow commented 10 months ago

Had the same blocker with standard spago, and the problem does not pop up with spago@next.

Mng12345 commented 5 months ago

I found, that error fatal: destination path '.' already exists and is not an empty directory. occurs in case if git not initialized.

I found, that "spago build" somehow calls git commands, because git icon in my VS Code changes during build. So, when i initialized git in a directory, the error went away.

Could anyone explain such behavior?

THANKS!!!

ruuda commented 2 months ago

I ran into this after updating to a newer Nixpkgs version, which bumped Spago from 0.20.9 to 0.21.1. On 0.20.9, in a clean checkout spago build worked just fine, on 0.21.1 it reports this error about a few dozen dependencies. If I first run spago build on 0.20.9 to download the dependencies, then building with 0.21.1 does work. This is on Linux.

I see that in https://github.com/NixOS/nixpkgs/pull/305970 which updated Spago in Nixpkgs it was actually noticed that the tests fail due to this issue, but it’s unclear to me if/how that was fixed.

f-f commented 2 months ago

@ruuda this error should not occur anymore with the new Spago rewrite (versions in the 0.93.x line). It's not on nixpkgs yet but you can get it through purescript-overlay. Try that out and see if that helps.

ruuda commented 2 months ago

It did! Spago 0.93.39 managed to download all packages without errors.