boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 180 forks source link

Windows 10, boot dev -- process cannot access file in temp. #649

Closed tensor-programming closed 6 years ago

tensor-programming commented 6 years ago

Running emacs on windows 10. Decided to install boot and try out Hoplon. Basically, when I run boot dev I get a few specific errors when changing the code inside of the emacs. The main errors are The process cannot access the file because it is being used by another process. and java.io.IOException: Couldn't delete C:\Users\user-name\.boot\cache\tmp\Projects\clojure\project-name\421\d82h8\file.html which hangs boot dev until i ctr-c and then rerun the command.

Oddly enough the errors start as soon as I type anything into emacs. Even just hitting return or adding a space will trigger this error if boot dev is running. Ill get an error like java.lang.UnsupportedOperationException: nth not supported on this type: Symbol then it will come back and say writing HTML files... index.html then the thread will hang and give me the used by another process. & cannot delete file errors again.

I get these errors with completely valid clojure code that will compile with boot if I rerun boot dev.

I've tried using an elevated cmd prompt as well as a different editor but I still get the same errors in Visual Studio Code and Atom (and I would really like to be able to use emacs).

matthewlal commented 6 years ago

These approaches should help:

  1. If you are using boot-http refer to this page https://github.com/pandeiro/boot-http/wiki/Using-with-windows

  2. If you are using Cursive with IntelliJ navigate to Settings > Appearance & Behaviour > System Settings > Use "safe write" (save changes to a temporary file first) You want to uncheck that option.

  3. If you have real-time anti-virus scanning disabling it may help.

  4. I also recommend running boot-clj in the Linux Subsystem for Windows (WSL). If you do this repeat step 2 and perhaps step 1 as well if it still doesn't work.

I was running boot-clj in WSL initially. My IFDE (Immediate Feedback Dev Environment) would stop running with exceptions if syntax wasn't correct, this wasn't ideal for me so I started troubleshooting. I installed boot-clj with choco in Windows 10, I was getting errors similar to what I was having before and the issues in this thread. After doing step 2 I had a feeling it would solve my issue, so I tested my IFDE in WSL and everything worked. I prefer working in WSL, so I uninstalled boot-clj in my windows environment.

tensor-programming commented 6 years ago

Alright Ill give it a shot. I really dislike using the linux subsystem for windows because its really unstable at times, but ill try the other 2. (Don't use Cursive, am using Emacs).

Edit: none of these seemed to change anything. I am not using boot-http (i am using boot-jetty), this is a standard Hoplon project. I am not using Cursive, I am using Emacs. I turned off the real-time anti-virus for windows defender but that didn't really do anything. I used Git Bash to try to run the Boot-clj but that didn't work either. I wont be using Windows Subsystem for Linux. I guess Ill have to go to my linux box and just not use my windows dev pipeline for hoplon if i do decide to use it, or Ill have to do things with lein instead of boot (which is a real pain in the ass since it doesn't naively support the Hlisp files).

Ironically, I did just find a fix for this problem that seems to be working thus far.

https://github.com/boot-clj/boot/wiki/Running-on-Windows

This wiki talks about running on windows. Specifically the problem seems to have been from how the serve function was working. Since I put in the extra parameter for org.eclipse.jetty.servlet.Default.useFileMappedBuffer I have not run into any write/delete errors with the cache files on user/.boot/cache and the hot reloading seems to be working fine.

I will update this post if the error comes back but this seems to be the solution.