Search code examples
powershellclojure

Clojure installed, but clj fails


I installed Clojure via Powershell on Windows 10 and it installed without any errors. When I typed "clj" however, it gave me the following error:

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

I installed it to the following location: C:\Program Files\WindowsPowerShell\Modules

How can I resolve this error?


Solution

  • I think you need to do run:

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

    Because your system does not allow execution of downloaded scripts. Of course decision about how much this is secure for you is completely up to you. I'd recommend to check this tutorial, written by me:

    https://github.com/littleli/scoop-clojure/wiki/Getting-started

    It provides alternative, and more convenient way to install Clojure. Also it provides easy path for updates and enables access to a growing amount of utilities that you may find helpful.

    Finally. If you have access to Windows Subsystem for Linux (WSL2), I'd probably go in that direction.