clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
puzzler 2020-12-15T02:50:32.094800Z

PS C:\Users\Mark> clj clj : The 'clj' command was found in the module 'ClojureTools', but the module could not be loaded. For more information, run 'Import-Module ClojureTools'. At line:1 char:1 + clj + ~ + CategoryInfo : ObjectNotFound: (clj:String) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule PS C:\Users\Mark> Import-Module ClojureTools Import-Module : File C:\Users\Mark\Documents\WindowsPowerShell\Modules\ClojureTools\ClojureTools.psm1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1 + Import-Module ClojureTools + + CategoryInfo : SecurityError: (:) [Import-Module], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand

puzzler 2020-12-15T02:50:54.095300Z

I just tried following the directions to install clj on Windows I found here: https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows

puzzler 2020-12-15T02:51:12.095800Z

The installation appeared to work, but I got the above error message when running clj

puzzler 2020-12-15T02:51:15.096Z

Tips?

puzzler 2020-12-15T03:15:36.096700Z

That has to do with installation failure. My install succeeded.

2020-12-15T03:16:19.097Z

sure, but the error message says: > cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

puzzler 2020-12-15T03:17:04.097400Z

True, and unfortunately that url doesn't actually lead to anything, so I wasn't able to follow up on that.

puzzler 2020-12-15T03:17:28.097900Z

I'm reluctant to change my execution policy without understanding the consequences, because... security.

2020-12-15T03:17:39.098100Z

yes, that is understandable

2020-12-15T03:18:26.098800Z

if you are not attached to using the "official" instructions, there is this option: https://github.com/littleli/scoop-clojure/

puzzler 2020-12-15T03:19:14.099400Z

1. Do I need to uninstall what I just installed for scoop to work? If so, how do I uninstall?

puzzler 2020-12-15T03:19:32.099900Z

2. I see the same issue for scoop, that I need to change my execution policy.

puzzler 2020-12-15T03:19:47.100300Z

PS C:\Users\Mark> iwr -useb get.scoop.sh | iex PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop. For example, to set the execution policy to 'RemoteSigned' please run : 'Set-ExecutionPolicy RemoteSigned -scope CurrentUser' PS C:\Users\Mark> Set-ExecutionPolicy RemoteSigned -scope CurrentUser

2020-12-15T03:20:00.100700Z

for 1, i don't have a definitive answer for you, but if you know the installation location, what has worked for me is to delete a particular folder

2020-12-15T03:20:44.101700Z

for 2, i don't have a good answer for you it's possible that @ales.najmann or @borkdude might have some insights into this situation

2020-12-15T03:21:31.102700Z

(i think they are not typically around for at least a few more hours though)

puzzler 2020-12-15T03:21:32.102800Z

I'm cool with changing execution policy for a single run of an install, but would want to know how to change it back, and that I can change it back and still have clj work.

2020-12-15T03:22:26.103700Z

yeah i understand where you are coming from. i don't know whether that will work in this case, but the aforementioned individuals might.

puzzler 2020-12-15T03:22:40.104Z

thanks for your help

2020-12-15T03:22:44.104200Z

good luck!

seancorfield 2020-12-15T03:49:57.105300Z

I would strongly recommend installing WSL2 if you can and doing all your Clojure work there, on Ubuntu (for example). VS Code has a Remote-WSL extension that gives you a full Windows experience even while all your code/REPL runs on Linux.

seancorfield 2020-12-15T03:50:31.105900Z

I tried working with PS for a while and I could get it to work but in the end it was all just too painful.

puzzler 2020-12-15T04:07:47.106400Z

If I run a local clojure web app from WSL2, can I connect to it from a browser running in Windows?

puzzler 2020-12-15T04:08:18.106800Z

In other words, can one see the ports in the other?

seancorfield 2020-12-15T05:45:53.107500Z

@puzzler Yes, WSL2 acts just like Windows native in my experience.

seancorfield 2020-12-15T05:47:00.108100Z

You may have to know IP addresses but it's all pretty transparent.

littleli 2020-12-15T15:14:09.109300Z

@puzzler the execution policy is for Powershell. I believe, once scoop is in place and able to run you can set the policy back with:

Set-ExecutionPolicy Undefined -scope CurrentUser
(example)

littleli 2020-12-15T15:24:35.111Z

modules are installed in modules folder inside userprofile's scoop directory similar to my setup (see below) so there should be no problem with access rights.