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
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
The installation appeared to work, but I got the above error message when running clj
Tips?
@puzzler does this bit have any relevance for you? https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows#install-fails-due-to-permission-errors
That has to do with installation failure. My install succeeded.
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.
True, and unfortunately that url doesn't actually lead to anything, so I wasn't able to follow up on that.
I'm reluctant to change my execution policy without understanding the consequences, because... security.
yes, that is understandable
if you are not attached to using the "official" instructions, there is this option: https://github.com/littleli/scoop-clojure/
1. Do I need to uninstall what I just installed for scoop to work? If so, how do I uninstall?
2. I see the same issue for scoop, that I need to change my execution policy.
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
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
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
(i think they are not typically around for at least a few more hours though)
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.
yeah i understand where you are coming from. i don't know whether that will work in this case, but the aforementioned individuals might.
thanks for your help
good luck!
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.
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.
If I run a local clojure web app from WSL2, can I connect to it from a browser running in Windows?
In other words, can one see the ports in the other?
@puzzler Yes, WSL2 acts just like Windows native in my experience.
You may have to know IP addresses but it's all pretty transparent.
@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)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.