Shadow-cljs: FileNotFoundException after vanilla install

Created on 2 Aug 2017  路  11Comments  路  Source: thheller/shadow-cljs

Hi Thomas!

Reporting an error here:

$ ./node_modules/.bin/shadow-cljs compile
shadow-cljs - config: /home/arichiardi/git/logpoc/shadow-cljs.edn version: 1.0.20170728
shadow-cljs - starting ...
Exception in thread "main" java.io.FileNotFoundException: Could not locate shadow/cljs/devtools/cli__init.class or shadow/cljs/devtools/cli.clj on classpath.
    at clojure.lang.RT.load(RT.java:456)
    at clojure.lang.RT.load(RT.java:419)
    at clojure.core$load$fn__5677.invoke(core.clj:5893)
    at clojure.core$load.invokeStatic(core.clj:5892)
    at clojure.core$load.doInvoke(core.clj:5876)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5697)
    at clojure.core$load_one.invoke(core.clj:5692)
    at clojure.core$load_lib$fn__5626.invoke(core.clj:5737)
    at clojure.core$load_lib.invokeStatic(core.clj:5736)
    at clojure.core$load_lib.doInvoke(core.clj:5717)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:648)
    at clojure.core$load_libs.invokeStatic(core.clj:5774)
    at clojure.core$load_libs.doInvoke(core.clj:5758)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:648)
    at clojure.core$require.invokeStatic(core.clj:5796)
    at clojure.main$main_opt.invokeStatic(main.clj:314)
    at clojure.main$main_opt.invoke(main.clj:310)
    at clojure.main$main.invokeStatic(main.clj:421)
    at clojure.main$main.doInvoke(main.clj:384)
    at clojure.lang.RestFn.invoke(RestFn.java:457)
    at clojure.lang.Var.invoke(Var.java:394)
    at clojure.lang.AFn.applyToHelper(AFn.java:165)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)

This is after a rm -Rf .m2/repository/thheller and a yarn add shadow-cljs --dev.

Most helpful comment

I changed how deps.edn is handled and you now need to add thheller/shadow-cljs {:mvn/version "2.8.40"} to your deps.edn manually.

All 11 comments

I have to add that commenting out the new version of clojurescript makes it work

EDIT:...no sorry, still not working I attach my shadow-cljs.edn...

{:dependencies
 [[org.clojure/clojure       "1.8.0"]
  ;; [org.clojure/clojurescript "1.9.854"]
  [io.nervous/cljs-lambda    "0.3.5"]]

 :source-paths ["src"]

 :builds [{:id :library
           :target :node-library
           :output-to "shadow/logpoc/index.js"
           :exports {:bunyan-lambda logpoc.core/bunyan-lambda}
           :compiler-options {:language-in :ecmascript5
                              :libs ["src/js"]}}]} 

See #73, can't add org.clojure/clojure that is not 1.9.

I would like to bump this very old version. I ~accidentally rm -rf ~/.m2 and now I cannot get shadow-cljs to work. No matter how many different ways I try to uninstall or start fresh, I keep getting:

Exception in thread "main" java.io.FileNotFoundException: Could not locate shadow/cljs/devtools/cli__init.class or shadow/cljs/devtools/cli.clj on classpath.

Delete .shadow-cljs/classpath.edn in your project. I will add a check to re-download dependencies if any of the classpath jars (ie. .m2) are missing.

I've got the same problem after rsyncing my whole project directory to a remote machine, and running shadow-cljs server. Under the help of @thheller , I deleted the .shadow-cljs/ directory, and run shadow-cljs server again. It works now.

Fixed in 2.2.28.

Hey @thheller ,
I'm afraid the problem reappeared in 2.8.40. I'm getting the same kind of error when I use shadow-cljs 2.8.40 on a newly created project but simply downgrading to 2.8.39 makes the error disappear.

stacktrace:

rm -rf .shadow-cljs/ node_modules/ && npm install && ./node_modules/.bin/shadow-cljs compile main

````
rm -rf .shadow-cljs/ node_modules/ && npm install && ./node_modules/.bin/shadow-cljs compile main
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

added 99 packages from 106 contributors and audited 664 packages in 6.926s
found 0 vulnerabilities

shadow-cljs - config: /Users/pk/learning/clojure/fulcro3/app/shadow-cljs.edn cli version: 2.8.40 node: v9.4.0
shadow-cljs - starting via "clojure"
Exception in thread "main" java.io.FileNotFoundException: Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.
at clojure.lang.RT.load(RT.java:466)
at clojure.lang.RT.load(RT.java:428)
at clojure.core$load$fn__6824.invoke(core.clj:6126)
at clojure.core$load.invokeStatic(core.clj:6125)
at clojure.core$load.doInvoke(core.clj:6109)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5908)
at clojure.core$load_one.invoke(core.clj:5903)
at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
at clojure.core$load_lib.invokeStatic(core.clj:5947)
at clojure.core$load_lib.doInvoke(core.clj:5928)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$load_libs.invokeStatic(core.clj:5985)
at clojure.core$load_libs.doInvoke(core.clj:5969)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$require.invokeStatic(core.clj:6007)
at clojure.main$main_opt.invokeStatic(main.clj:491)
at clojure.main$main_opt.invoke(main.clj:487)
at clojure.main$main.invokeStatic(main.clj:598)
at clojure.main$main.doInvoke(main.clj:561)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:37)
````

shadow-cljs.edn

edn {:deps {:aliases [:dev]} :dev-http {8000 "classpath:public"} :builds {:main {:target :browser :output-dir "resources/public/js/main" :asset-path "/js/main" :modules {:main {:init-fn app.client/init :entries [app.client]}} :devtools {:after-load app.client/refresh :preloads [com.fulcrologic.fulcro.inspect.preload]}}}}

I changed how deps.edn is handled and you now need to add thheller/shadow-cljs {:mvn/version "2.8.40"} to your deps.edn manually.

It worked! Thank you!

Got hit by this again on an old project. Can shadow-cljs please warn about this?

Only at the cost of making all startups slower.

The problem is that if shadow-cljs isn't on the classpath (so not included by either deps.edn or project.clj) then the code that would check if its present won't be either. So the one way to do this is first run lein classpath or clj -Spath to generate the classpath and look for shadow-cljs by via the npm CLI script. That has a cost that isn't necessary if everything is configured correctly.

Can't just look at deps.edn either because someone may have configured it via the ~/.clojure/deps.edn or so. Can't check project.clj because that might be using lein-tools-deps. Can't check the output of the server to at least display a better error since all output is piped directly to stdout and shadow-cljs never sees it.

It was my mistake to add the automatic dependency inject in the first place. Tried to be clever and only caused problems in return (at least for me).

Just use shadow-cljs.edn and you'll never have that problem. ;)

Was this page helpful?
0 / 5 - 0 ratings