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

Error: was not able to get a directory for the global cache (Windows) #312

Closed
sharno opened this issue Jul 10, 2019 · 5 comments

Comments

@sharno
Copy link

commented Jul 10, 2019

On a Windows machine, I installed spago using npm

> npm -g i spago
> spago init
> spago install react-basic

I get this error with spago install or spago build

Error: was not able to get a directory for the global cache. Set either `HOME` or `XDG_CACHE_HOME`
spago.exe: user error (mzero)
@f-f

This comment has been minimized.

Copy link
Member

commented Jul 11, 2019

Hi @sharno! This is a normal error condition, and in fact the error message is telling you that you should define either the HOME or the XDG_CACHE_HOME environment variable, and point it to a path where Spago can put its global cache

If this makes sense, how can we make this error message clearer?

In any case you should be able to disable the global cache with --global-cache skip

@sharno

This comment has been minimized.

Copy link
Author

commented Jul 12, 2019

Hi @f-f , thanks for your reply

I think on Windows the environment variable is called HomePath instead of just HOME. Which points generally to \Users\{username} where I find most of the tools' cache folders like .sbt or .stack

http://environmentvariables.org/HomePath

Otherwise maybe the error should specify explicitly that HOME or XDG_CACHE_HOME or HomePath (if added) are environment variables.

@f-f

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

@sharno thanks! Fix up in #314 🙂

@sharno

This comment has been minimized.

Copy link
Author

commented Jul 12, 2019

@f-f Thanks a lot for the quick fix :)

Just one more thing, everything worked fine after I added the environment variable. But when I tried without it but with --global-cache=skip or --global-cache skip it still throws the same error. Thought I'd mention in case if it's a different bug?

@f-f

This comment has been minimized.

Copy link
Member

commented Jul 13, 2019

@sharno you're welcome! 🙂

Thought I'd mention in case if it's a different bug?

Yeah it's a known problem. I looked into disabling the whole logic for global cache (which is probably the right thing to do) if this failed, but at this point there are too many code changes in flight that touch nearby code, so what I did in #314 was to always make this operation succeed, so we shouldn't encounter this error ever again :)

@f-f f-f closed this in #314 Jul 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.