5
votes

Total rookie here. I am trying to run ClojureScript for the first time and followed the quickstart tutorial. However, upon entering...

clj --main cljs.main --compile hello-world.core --repl

I get the following error message:

Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
FileNotFoundException: Could not locate cljs/main__init.class or cljs/main.clj on classpath.
4
You need to specify which platform, it's different between windows and *nix. - Jared Smith
I had the same issue, I had a deps file with the clojurescript dependency. The reason it didn't work for me is I was running the clj command in the src directory. I switched to the directory containing the deps file and it worked instantly. - nakamin
@nakamin Excellent. - David Tonhofer

4 Answers

4
votes

It can’t find the cljs.main in the Clojurescript jar. As the QuickStart mentions, you need a deps.edn for Mac/Linux or the cljs.jar for Windows.

0
votes

I'm not sure about your specific error, but I created a CLJS sample project that will get you started:

https://github.com/cloojure/cljs-base-project

Just clone the repo to your computer, then you can run the Doo unit tests:

> lein clean; lein doo chrome test once

or use Figwheel:

> lein clean; lein figwheel
0
votes

This error surfaces when one runs clj --main cljs.main --compile hello-world.core --repl from directory or path which does not have file deps.end or cljs.jar.

Considering the directory structure at https://clojurescript.org/guides/quick-start,

hello-world  #### Run that command in this directory
├─ src   
│  └─ hello_world
│     └─ core.cljs 
├─ cljs.jar 
└─ deps.edn 
0
votes

Make sure you are in the hello-world project directory and run the following command....

Docs are wrong, run the command on the root where deps.edn exist