spago
spago copied to clipboard
spago fails to add dependencies inside directories managed by Dropbox in Windows
I'm running WIndows 11 with Git for Windows and spago 0.20.9 installed via npm. When I create a project via spago init
inside a subdirectory of my Dropbox directory and then run spago build
, I get:
[info] Installing 3 dependencies.
[info] Searching for packages cache metadata..
[info] Recent packages cache metadata found, using it..
[info] Installing "console"
[info] Installing "prelude"
[info] Installing "effect"
[error]
Failed to install dependency "console"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
However, if I create a project somewhere outside of my Dropbox directory, it builds and runs as expected.
My suspicion is that Dropbox is (temporarily) putting some hidden file that git doesn't like in the directory that spago creates to clone the dependency repository. I cannot confirm, but a potential fix is to allow git to create the directory, i.e., by calling git clone <repo> <dir>
for nonexistent <dir>
instead of creating the directory first, cd
ing to it, and calling git clone <repo> .
.
We use temporary directories to clone things into (so that they are ephemeral if things go wrong and we have to abort things mid-flight), and that seems to be quite fiddly on Windows, especially if the destination is on a different file system (i.e. if your temp folder is in C
and the Dropbox folder is in the D
drive).
Moreover, in my experience git+Dropbox is not a very reliable/pleasant combination, even on Linux (my main OS at the moment).
So I am not sure I have a good suggestion here other than discouraging this setup?
I have the same problem. In a new directory after spago init
, when I run spago build --verbose
I get:
[debug] Running `getGlobalCacheDir`
[debug] Transformed config is the same as the read one, not overwriting it
[debug] Ensuring that the package set is frozen
[debug] Getting transitive deps
[debug] Running `fetchPackages`
[debug] Checking if `purs` is up to date
[debug] Directory ".spago" does not exist, creating...
[info] Installing 3 dependencies.
[debug] Running `getMetadata`
[debug] Global cache directory: "C:\\Users\\MyName\\AppData\\Local\\spago"
[info] Searching for packages cache metadata..
[info] Recent packages cache metadata found, using it..
[debug] Fetching package prelude
[debug] Fetching package console
[debug] Fetching package effect
[debug] Directory ".spago\\__download-prelude-v6.0.1-4adb8facf180d65a\\download" does not exist, creating...
[debug] Directory ".spago\\__download-console-v6.0.0-48833ed1ed4dc67e\\download" does not exist, creating...
[debug] Directory ".spago\\__download-effect-v4.0.0-2f545322b26c8d39\\download" does not exist, creating...
[debug] Directory ".spago\\console" does not exist, creating...
[debug] Directory ".spago\\prelude" does not exist, creating...
[debug] Running `globallyCache`: PackageName {packageName = "prelude"} https://github.com/purescript/purescript-prelude.git v6.0.1
[debug] Running `globallyCache`: PackageName {packageName = "console"} https://github.com/purescript/purescript-console.git v6.0.0
[debug] Directory ".spago\\effect" does not exist, creating...
[debug] Running `globallyCache`: PackageName {packageName = "effect"} https://github.com/purescript/purescript-effect.git v4.0.0
[info] Installing "console"
[info] Installing "effect"
[info] Installing "prelude"
[error]
Failed to install dependency "prelude"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
[error]
Failed to install dependency "prelude"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
[error] Installation failed
[error] Error:
[error] ExitFailure 1
The folder is not synced with any service at least to my knowledge (work laptop). I cleared the global cache which is in my user directory, part of which is synced. I also tried spago build -c skip
. None of thease helped.
Versions are
> spago version
0.20.9
> git --version
git version 2.38.1.windows.1
There are no hidden folders in .spago
either.
I'm getting exactly the same problem, but in my case it's on FreeBSD operating system. I'm quite sure there isn't anything getting in the way such as DropBox. In a newly created project the output of an attempt to build is as follows:
> spago build --verbose
[debug] Running `getGlobalCacheDir`
[debug] Transformed config is the same as the read one, not overwriting it
[debug] Ensuring that the package set is frozen
[debug] Getting transitive deps
[debug] Running `fetchPackages`
[debug] Checking if `purs` is up to date
[info] Installing 3 dependencies.
[debug] Running `getMetadata`
[debug] Global cache directory: "/home/ben/.cache/spago"
[info] Searching for packages cache metadata..
[info] Recent packages cache metadata found, using it..
[debug] Fetching package console
[debug] Fetching package prelude
[debug] Fetching package effect
[debug] Directory ".spago/__download-effect-v4.0.0-616e6c2bdf69e083/download" does not exist, creating...
[debug] Directory ".spago/__download-console-v6.0.0-1bd5d9017d820e39/download" does not exist, creating...
[debug] Directory ".spago/__download-prelude-v6.0.1-e6cad3d52ab3e53b/download" does not exist, creating...
[debug] Running `globallyCache`: PackageName {packageName = "effect"} https://github.com/purescript/purescript-effect.git v4.0.0
[debug] Running `globallyCache`: PackageName {packageName = "prelude"} https://github.com/purescript/purescript-prelude.git v6.0.1
[debug] Running `globallyCache`: PackageName {packageName = "console"} https://github.com/purescript/purescript-console.git v6.0.0
[info] Installing "effect"
[info] Installing "prelude"
[info] Installing "console"
[error]
Failed to install dependency "effect"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
[error]
Failed to install dependency "console"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
[error]
Failed to install dependency "effect"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
[error]
Failed to install dependency "console"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
[error] Installation failed
[error] Error:
[error] ExitFailure 1
and the versions are:
> git -v
git version 2.38.1
> spago --version
0.20.9
A similar thing happens with an old project, just longer because it does the same thing for every dependency. I asked a while ago at discourse, where there was a similar problem. Someone did find the location in the code but beyond checking that is it (ie it tries twice for each package etc) I can't make much of that.
Thanks in advance.
I had the same issue under Windows. It could be related to current folder name. Although there were no blanks in my path. I moved the current folder to top level (E:\repo), ran spago build
successfully and moved the folder back to its place.
Same issue on FreeBSD without dopbox. On purescript-book exercises: https://github.com/purescript-contrib/purescript-book/issues/443
Would anyone like to try spago@next
to see if the issue is still present?
This issue no longer occurs with spago@next
on FreeBSD (at least on v. 13.2). That is I can now install and run a new project. Thanks for all your work. Sometime soon I hope to change an existing project back from bower/pulp to check it more thoroughly.
Thanks @bensnowball, this is great 🙂
I think we can close this as solved then