reagent-project / reagent-template

A Leiningen template for projects using Reagent.
MIT License
394 stars 55 forks source link

Figwheel hangs when trying to run on a clean app #133

Open tensor-programming opened 7 years ago

tensor-programming commented 7 years ago

When I run lein figwheel, I get "Prompt will show when Figwheel connects to your application" and it sits and hangs for an infinite amount of time. When I run it with lein run, the server tells me that the clojurescript has not been compiled and that I need to run figwheel.

Even after running lein clean first, the figwheel wont connect to my application. Also when Figwheel is hanging, I can access the server but I still get the bit of clojure that is saying that I need to compile my clojurescript. If i just build my own project or use lein figwheel or a re-frame template, everything seems to work correctly without problems. It is only with the reagent template that I seem to be having this issue.

I am on windows 10 with java 1.8 and the latest version of lein.

Edit: I was able to access the figwheel repl and get past the "Prompt will show when Figwheel connects to your application" if I run both lein run and lein figwheel in two separate cmd prompts, however, my clojurescript still does not compile correctly.

yogthos commented 7 years ago

Unfortunately, I don't have a Windows machine to test with. I tried locally on MacOS and was not able to replicate the issue. The only thing I can think of would be to check if you have any plugins in your .lein/profiles.clj that might be causing a problem.

kasbah commented 7 years ago

I am having the same issue on Ubuntu Linux, Java 1.8

yogthos commented 7 years ago

Could it be something with firewall properties?

kasbah commented 7 years ago

I don't think so, but how would I check?

yogthos commented 7 years ago

You'd have to check your iptables rules.

kasbah commented 7 years ago

Ah ok, that can't be it. I am on a laptop on my home network and haven't set up any rules. iptables -L shows it is accepting anything from anywhere! :scream: :laughing:

yogthos commented 7 years ago

Yeah that was kind of a long shot. Localhost is typically not blocked. It might be worth checking on Clojurians Slack or opening an issue for lein-figwheel, as it appears to be a Figwheel specific issue.

kasbah commented 7 years ago

Sorry, I didn't read the issue properly late last night. For me it is actually just lein figwheel devcards that hangs. lein figwheel works fine. Probably a different thing.

yogthos commented 7 years ago

Hmm, can't reproduce that either. I start the app with

lein figwheel devcards

and then I'm able to navigate to http://localhost:3449/cards

kasbah commented 7 years ago

Ah, I didn't realize I needed to go to that path. Thanks for your help and really sorry for wasting your time! :confused:

yogthos commented 7 years ago

No worries, glad everything is working. 👍

FFrancieli commented 6 years ago

I had a similar issue and I realized that it occurs because it's necessary to create a html page that imports the compiled javascript as defined on project.cls configuration.

This is my configuration:

:builds [{
      :id "dev"
      :source-paths ["src"]
      :figwheel true
      :compiler {
        :main clojurescript-tdd-application.core
        :asset-path "cljs/out"
        :output-to "resources/public/cljs/main.js"
        :output-dir "resources/public/out"
        :source-map-timestamp true
      }}

This way you need to import the file main.js on your index.html as defined on :output-to. After that you just need to run lein figwheel or the command you use to run figwheel and then type localhost:3449 on your browser. This worked for me.

This page has a better description on how to solve it as well.

yogthos commented 6 years ago

@FFrancieli do you think there's anything that could be changed in the template to make things smoother here?

jmargolisvt commented 6 years ago

Same issue on OSX. @FFrancieli can you offer a bit more about your workaround? Is there a fix in the works?

loganpowell commented 6 years ago

Having this issue myself on Windows 10

dunhamsteve commented 6 years ago

I had this issue on OSX and eventually figured out the problem (for me) was uMatrix. The url in the figwheel output was http://0.0.0.0:3449 and then uMatrix blocked an XHR request to "localhost".

aardvark commented 5 years ago

Have same problem on Win10. 'lein figwheel' - stuck (but woke up after visiting localhost:3449) 'lein repl' -> (start-server) - works

On the other hand, 'lein figwheel' works when created from template 'reagent-frontend'. Hope this can clear something, i am not sure for now how all this works.

aardvark commented 5 years ago

Looks like my problem was related to devcards only. I was able to refute it with couple of small fixes. I've raised pr for them.

yogthos commented 5 years ago

Thanks, just pushed out a new version with the PR fixes.