lein-figwheel icon indicating copy to clipboard operation
lein-figwheel copied to clipboard

Figwheel does not work on Windows

Open alexnixon opened this issue 6 years ago • 4 comments

I'm unable to run figwheel - any help on this would be much appreciated. I've dumped all the info I can think might be useful below.

I can compile fine with lein cljsbuild once ,but with figwheel (on Windows 10, in case that matters):

> lein figwheel
Figwheel: Cutting some fruit, just a sec ...
Exception in thread "main" java.io.FileNotFoundException: Could not locate net/cgrand/parsley__init.class or net/cgrand/parsley.clj on classpath., compiling:(net/cgrand/sjacket/parser.clj:1:1)

Boring bits removed from the stacktrace:

Exception in thread "main" java.io.FileNotFoundException: Could not locate net/cgrand/parsley__init.class or net/cgrand/parsley.clj on classpath., compiling:(net/cgrand/sjacket/parser.clj:1:1)
        [ ... ]
        at net.cgrand.sjacket$eval2024$loading__6434__auto____2025.invoke(sjacket.clj:1)
        at net.cgrand.sjacket$eval2024.invokeStatic(sjacket.clj:1)
        at net.cgrand.sjacket$eval2024.invoke(sjacket.clj:1)
        [ ... ]
        at strictly_specking_standalone.edn_string_nav$eval2016$loading__6434__auto____2017.invoke(edn_string_nav.clj:1)
        at strictly_specking_standalone.edn_string_nav$eval2016.invokeStatic(edn_string_nav.clj:1)
        at strictly_specking_standalone.edn_string_nav$eval2016.invoke(edn_string_nav.clj:1)
        [ ... ]
        at strictly_specking_standalone.core$eval424$loading__6434__auto____425.invoke(core.clj:1)
        at strictly_specking_standalone.core$eval424.invokeStatic(core.clj:1)
        at strictly_specking_standalone.core$eval424.invoke(core.clj:1)
        [ ... ]
        at figwheel_sidecar.config$eval165$loading__6434__auto____166.invoke(config.clj:1)
        at figwheel_sidecar.config$eval165.invokeStatic(config.clj:1)
        at figwheel_sidecar.config$eval165.invoke(config.clj:1)
        [ ... ]
        at figwheel_sidecar.build_utils$eval159$loading__6434__auto____160.invoke(build_utils.clj:1)
        at figwheel_sidecar.build_utils$eval159.invokeStatic(build_utils.clj:1)
        at figwheel_sidecar.build_utils$eval159.invoke(build_utils.clj:1)
        [ ... ]
        at figwheel_sidecar.repl_api$eval153$loading__6434__auto____154.invoke(repl_api.clj:1)
        at figwheel_sidecar.repl_api$eval153.invokeStatic(repl_api.clj:1)
        at figwheel_sidecar.repl_api$eval153.invoke(repl_api.clj:1)

My project.clj (this is a mixed clj/cljs project I'm afraid) is:

(defproject something "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.9.0"]
                 [org.clojure/data.csv "0.1.4"]
                 [org.clojure/java.jdbc "0.7.5"]
                 [org.postgresql/postgresql "42.2.2"]
                 [compojure "1.6.1"]
                 [ring/ring-json "0.4.0"]
                 [javax.servlet/servlet-api "2.5"]

                 ; cljs
                 [org.clojure/clojurescript "1.10.238" :exclusions [org.apache.ant/ant]]
                 [hiccup "1.0.5"]
                 [reagent "0.7.0"]
                 [re-frame "0.10.5"]
                 [cljs-ajax "0.7.3"]
                 [cljsjs/google-maps "3.18-1"]]
  :plugins [[lein-cljsbuild "1.1.7"]
            [lein-ring "0.12.4"]
            [lein-figwheel "0.5.15"]]

  ; :hooks [leiningen.cljsbuild]

  :cljsbuild {:builds [{:id           "dev"
                        :source-paths ["src-cljs"]
                        :figwheel     true
                        :compiler     {:main          something.core
                                       :asset-path    "js/out"
                                       :source-map    true
                                       :output-to     "resources/public/js/main.js"
                                       :output-dir    "resources/public/js/out"
                                       :optimizations :none}}]}

  ; :clean-targets ^{:protect false} ["resources/public/js"]

  :ring {:handler something.routes/app})

And the output from lein deps :tree:

>lein deps :tree
Possibly confusing dependencies found:
[ring/ring-json "0.4.0"] -> [cheshire "5.5.0"]
 overrides
[cljs-ajax "0.7.3"] -> [cheshire "5.7.1"]

Consider using these exclusions:
[cljs-ajax "0.7.3" :exclusions [cheshire]]

[ring/ring-json "0.4.0"] -> [cheshire "5.5.0"] -> [com.fasterxml.jackson.core/jackson-core "2.5.3"]
 overrides
[cljs-ajax "0.7.3"] -> [com.cognitect/transit-clj "0.8.300"] -> [com.cognitect/transit-java "0.8.324"] -> [com.fasterxml.jackson.core/jackson-core "2.8.7"]
 and
[cljs-ajax "0.7.3"] -> [cheshire "5.7.1"] -> [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.8.6"] -> [com.fasterxml.jackson.core/jackson-core "2.8.6"]
 and
[cljs-ajax "0.7.3"] -> [cheshire "5.7.1"] -> [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.8.6"] -> [com.fasterxml.jackson.core/jackson-core "2.8.6"]
 and
[org.clojure/clojurescript "1.10.238" :exclusions [org.apache.ant/ant]] -> [com.cognitect/transit-clj "0.8.300" :exclusions [org.clojure/clojure]] -> [com.cognitect/transit-java "0.8.324"] -> [com.fasterxml.jackson.core/jackson-core "2.8.7"]
 and
[cljs-ajax "0.7.3"] -> [cheshire "5.7.1"] -> [com.fasterxml.jackson.core/jackson-core "2.8.6"]

Consider using these exclusions:
[cljs-ajax "0.7.3" :exclusions [com.fasterxml.jackson.core/jackson-core]]
[org.clojure/clojurescript "1.10.238" :exclusions [org.apache.ant/ant com.fasterxml.jackson.core/jackson-core]]

[ring/ring-json "0.4.0"] -> [cheshire "5.5.0"] -> [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.5.3"]
 overrides
[cljs-ajax "0.7.3"] -> [cheshire "5.7.1"] -> [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.8.6"]

Consider using these exclusions:
[cljs-ajax "0.7.3" :exclusions [com.fasterxml.jackson.dataformat/jackson-dataformat-smile]]

[ring/ring-json "0.4.0"] -> [cheshire "5.5.0"] -> [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.5.3"]
 overrides
[cljs-ajax "0.7.3"] -> [cheshire "5.7.1"] -> [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.8.6"]

Consider using these exclusions:
[cljs-ajax "0.7.3" :exclusions [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor]]

 [cljs-ajax "0.7.3"]
   [com.cognitect/transit-cljs "0.8.243"]
     [com.cognitect/transit-js "0.8.846"]
   [net.colourcoding/poppea "0.2.1"]
   [org.apache.httpcomponents/httpasyncclient "4.1.3"]
     [commons-logging "1.2"]
     [org.apache.httpcomponents/httpclient "4.5.3"]
     [org.apache.httpcomponents/httpcore-nio "4.4.6"]
   [org.apache.httpcomponents/httpcore "4.4.6"]
 [cljsjs/google-maps "3.18-1"]
 [clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
 [compojure "1.6.1"]
   [clout "2.2.1"]
     [instaparse "1.4.8" :exclusions [[org.clojure/clojure]]]
   [medley "1.0.0"]
   [org.clojure/tools.macro "0.1.5"]
   [ring/ring-codec "1.1.0"]
     [commons-codec "1.10"]
   [ring/ring-core "1.6.3"]
     [clj-time "0.11.0"]
       [joda-time "2.8.2"]
     [commons-fileupload "1.3.3"]
     [commons-io "2.5"]
     [crypto-equality "1.0.0"]
     [crypto-random "1.2.0"]
 [hiccup "1.0.5"]
 [javax.servlet/servlet-api "2.5"]
 [org.clojure/clojure "1.9.0"]
   [org.clojure/core.specs.alpha "0.1.24"]
   [org.clojure/spec.alpha "0.1.143"]
 [org.clojure/clojurescript "1.10.238" :exclusions [[org.apache.ant/ant]]]
   [com.cognitect/transit-clj "0.8.300" :exclusions [[org.clojure/clojure]]]
     [com.cognitect/transit-java "0.8.324"]
       [org.msgpack/msgpack "0.6.12"]
         [com.googlecode.json-simple/json-simple "1.1.1" :exclusions [[junit]]]
         [org.javassist/javassist "3.18.1-GA"]
   [com.google.javascript/closure-compiler-unshaded "v20180204"]
     [args4j "2.33"]
     [com.google.code.findbugs/jsr305 "3.0.1"]
     [com.google.code.gson/gson "2.7"]
     [com.google.errorprone/error_prone_annotations "2.0.18"]
     [com.google.guava/guava "22.0"]
       [com.google.j2objc/j2objc-annotations "1.1"]
       [org.codehaus.mojo/animal-sniffer-annotations "1.14"]
     [com.google.javascript/closure-compiler-externs "v20180204"]
     [com.google.jsinterop/jsinterop-annotations "1.0.0"]
     [com.google.protobuf/protobuf-java "3.0.2"]
   [org.clojure/data.json "0.2.6"]
   [org.clojure/google-closure-library "0.0-20170809-b9c14c6b"]
     [org.clojure/google-closure-library-third-party "0.0-20170809-b9c14c6b"]
   [org.clojure/tools.reader "1.3.0-alpha3"]
   [org.mozilla/rhino "1.7R5"]
 [org.clojure/data.csv "0.1.4"]
 [org.clojure/java.jdbc "0.7.5"]
 [org.clojure/tools.nrepl "0.2.12" :exclusions [[org.clojure/clojure]]]
 [org.postgresql/postgresql "42.2.2"]
 [re-frame "0.10.5"]
   [net.cgrand/macrovich "0.2.0"]
   [org.clojure/tools.logging "0.3.1"]
 [reagent "0.7.0"]
   [cljsjs/create-react-class "15.5.3-0"]
   [cljsjs/react-dom-server "15.5.4-0"]
   [cljsjs/react-dom "15.5.4-0"]
     [cljsjs/react "15.5.4-0"]
 [ring/ring-json "0.4.0"]
   [cheshire "5.5.0"]
     [com.fasterxml.jackson.core/jackson-core "2.5.3"]
     [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.5.3"]
     [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.5.3"]
     [tigris "0.1.1"]

This error survives lein clean, though if there's a more thorough variant of that that I could try, I'm all ears.

alexnixon avatar Apr 20 '18 22:04 alexnixon

This is most certainly an environmental problem, as sjacket is a dependency and it should be on your classpath for sure.

But try adding :figwheel { :validate-config false } to your project.clj, this will bypass the code that is causing the problem. But there is obviously something wrong with your system.

Another thing to note, the stacktrace looks like its in the middle of throwing a configuration error, and the project.clj you have shown me doesn't have one as far as I can see.

bhauman avatar Apr 26 '18 02:04 bhauman

Thanks for the reply. Since reporting this the missing dependency has changed - it's now http-kit. And earlier today it was a google MultiMap class.

So I hacked figwheel and added this at the top of figwheel_server: (println "java.class.path=" (System/getProperty "java.class.path"))

And here's where it gets interesting. The classpath is as long as your arm and, spot checking a few entries, it all looks correct. APART from this:

C:\User\Alex\.m2\repository\http-kit\http-kit\2.2.0\http-kit-2.2.0.jar

The directory C:\User doesn't exist on my system - it should be C:\Users (with an s), like the other bajillion correct classpath entries. So bizarrely a single character has been dropped - which is exactly the same issue as I saw in #681.

So it looks like something is eating random characters from the command line. Honestly I'm at a bit of a loss as to what could cause something like this.

Do you have any ideas?

alexnixon avatar Apr 26 '18 23:04 alexnixon

@bhauman I've debugged this further and am arriving at the conclusion that lein trampoline, and so figwheel, does not work on Windows. Or rather, it works until you reach a certain number of dependencies, and thereafter you see undefined behaviour.

alexnixon avatar Apr 30 '18 20:04 alexnixon

OK so now that we think we know what's causing the problem.

Add :readline false to your :figwheel config and run lein figwheel as this will bypass trampoline.

And if you want the readline library to work, I'll help you get figwheel running with a script.

bhauman avatar Apr 30 '18 22:04 bhauman