This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-14
Channels
- # 100-days-of-code (4)
- # announcements (1)
- # beginners (63)
- # boot (22)
- # braveandtrue (104)
- # calva (3)
- # cider (12)
- # cljs-dev (53)
- # cljsjs (3)
- # cljsrn (1)
- # clojure (180)
- # clojure-dev (14)
- # clojure-italy (4)
- # clojure-nl (11)
- # clojure-spec (15)
- # clojure-uk (60)
- # clojure-ukraine (1)
- # clojurescript (118)
- # clojutre (3)
- # core-async (12)
- # core-logic (17)
- # cursive (19)
- # datomic (45)
- # devcards (4)
- # emacs (7)
- # figwheel-main (218)
- # fulcro (27)
- # funcool (3)
- # graphql (1)
- # jobs (4)
- # leiningen (57)
- # off-topic (71)
- # pedestal (2)
- # portkey (17)
- # re-frame (5)
- # reitit (4)
- # remote-jobs (2)
- # ring (11)
- # rum (2)
- # shadow-cljs (14)
- # specter (11)
- # sql (34)
- # tools-deps (23)
Trying to install figwheel.main as per the instructions at https://figwheel.org/tutorial . However, I get the following error:
➜ figwheel_test clj -m figwheel.main
[Figwheel] Compiling build figwheel-default-repl-build to "/var/folders/fd/w1x6p8k14n7c4snc157xbqsh0000gn/T/figwheel15853421684972697414repl/public/cljs-out/main.js"
[Figwheel] Successfully compiled build figwheel-default-repl-build to "/var/folders/fd/w1x6p8k14n7c4snc157xbqsh0000gn/T/figwheel15853421684972697414repl/public/cljs-out/main.js" in 5.787 seconds.
[Figwheel] Starting Server at
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Exception in thread "main" clojure.lang.ExceptionInfo: Figwheel: Unable to dynamicly load figwheel.server.jetty-websocket/run-server {:not-loaded figwheel.server.jetty-websocket/run-server}
at clojure.core$ex_info.invokeStatic(core.clj:4739)
at clojure.core$ex_info.invoke(core.clj:4739)
at figwheel.repl$dynload.invokeStatic(repl.cljc:1076)
at figwheel.repl$dynload.invoke(repl.cljc:1072)
at figwheel.repl$run_default_server_STAR_.invokeStatic(repl.cljc:1095)
at figwheel.repl$run_default_server_STAR_.invoke(repl.cljc:1092)
at figwheel.repl$run_default_server.invokeStatic(repl.cljc:1129)
at figwheel.repl$run_default_server.invoke(repl.cljc:1128)
at figwheel.repl$setup.invokeStatic(repl.cljc:1198)
at figwheel.repl$setup.invoke(repl.cljc:1193)
at figwheel.repl.FigwheelReplEnv._setup(repl.cljc:1299)
at cljs.repl$repl_STAR_$fn__6607.invoke(repl.cljc:942)
at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1289)
at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1278)
--more--
I've tried googling for it, and also ensuring if another server/repl might be running. Also tried the same after a machine restart.
Is your os by any chance windows? Check this out https://github.com/bhauman/figwheel-main/issues/74
@U9DNZGVN2 are you following the tutorial to the letter?
@U9DNZGVN2 when your available let me know I’d like to get to the bottom of this
@bhauman Hey, just came online. I'm using mac os x (10.13.6), Java 1.8.0_181, clojure 1.9
I followed the tutorial to the letter afaik (this is only the second step, immediately after writing out deps.edn). I wanted to set up figwheel from first principles (without lein magic).
@U9DNZGVN2 yeah this is tough
@U9DNZGVN2 do you have a CLASSPATH environment variable set or anything strange related to Java
Reinstalled clojure. Still get the same error 😞 Also tried changing default browser from Chrome to Safari (I was wondering if there was some browser issue because jetty wasn't able to open a websocket with it). Still same error. Anyway, I thought I was doing some noob stupidity. It doesn't seem like it. Let me grope around a bit more. Will report here if I figure how to fix it. Thanks again.
@U9DNZGVN2 I’m going to ask you to try a newer version of figwheel in a minute
@U9DNZGVN2 I’m thinking you delete your ~/.m2
directory and try again
removing ~/.m2
didn't help. Changing deps.edn
to {:deps {com.bhauman/figwheel-main {:mvn/version "0.2.0-SNAPSHOT"}}}
gave the following:
Downloading: clj-time/clj-time/0.14.3/clj-time-0.14.3.jar from
Downloading: org/eclipse/jetty/websocket/websocket-servlet/9.2.24.v20180105/websocket-servlet-9.2.24.v20180105.jar from
Downloading: org/eclipse/jetty/jetty-security/9.2.24.v20180105/jetty-security-9.2.24.v20180105.jar from
Downloading: ring/ring-codec/1.1.1/ring-codec-1.1.1.jar from
Downloading: ring/ring-anti-forgery/1.3.0/ring-anti-forgery-1.3.0.jar from
Downloading: com/bhauman/figwheel-core/0.2.0-SNAPSHOT/figwheel-core-0.2.0-20180914.141640-1.jar from
Downloading: org/eclipse/jetty/websocket/websocket-server/9.2.24.v20180105/websocket-server-9.2.24.v20180105.jar from
Downloading: org/eclipse/jetty/websocket/websocket-common/9.2.24.v20180105/websocket-common-9.2.24.v20180105.jar from
Downloading: ring/ring-servlet/1.7.0/ring-servlet-1.7.0.jar from
Downloading: ring/ring/1.7.0/ring-1.7.0.jar from
Downloading: org/eclipse/jetty/jetty-server/9.2.24.v20180105/jetty-server-9.2.24.v20180105.jar from
Downloading: ring/ring-core/1.7.0/ring-core-1.7.0.jar from
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/http/HttpParser$ProxyHandler, compiling:(ring/adapter/jetty.clj:28:9)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7010)
at clojure.lang.Compiler.analyze(Compiler.java:6773)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6991)
at clojure.lang.Compiler.analyze(Compiler.java:6773)
at clojure.lang.Compiler.analyze(Compiler.java:6729)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6100)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6420)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7003)
at clojure.lang.Compiler.analyze(Compiler.java:6773)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6991)
at clojure.lang.Compiler.analyze(Compiler.java:6773)
at clojure.lang.Compiler.analyze(Compiler.java:6729)
@U9DNZGVN2 that is so strange, but this is the error that’s causing your problems I’m going to investigate further
@U9DNZGVN2 yeah I think there is something off with your system, what version of Java are you running?
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
@U9DNZGVN2 one more thing to try rm -rf .cpcache
in the directory
Just tried that. Removed both .m2
and .cpcache
. Also reinstalled java to 10.x ... Still same error.
Hey @bhauman, I finally figured the problem. My ~/.clojure/deps.edn
had com.datomic/client-pro {:mvn/version "0.8.17"}
in it. Removing it solved the problem.
This seems similar to the problem stated here: https://clojurians-log.clojureverse.org/datomic/2017-06-05 . There is a conflict in jetty versions in different dependencies. I'm not sure how/if you can solve this problem in figwheel itself.
Hope this is helpful in case someone else reports a similar issue. Thanks again for all your help.
Hmm I had situation when figwheel-main didn’t load form-validator-demo.events
. I was restarting it (stop REPL and again run clj -A:fig -A:build
) and trying everything. After all I added (println "foo")
to form-validator-demo.events
and then it started to work. I removed it again and it works. It looks like something didn’t load, unless I touched form-validator-demo.events
file.
but then you start it up later and the poorly compiled code is still in the output directory
ok thx, so conclusion is I will never know when it is time to clean 😉 Not all bugs are so obviously 🙂
I really like the future :npm {:bundles {"dist/index_bundle.js" "src/js/index.js"}}
🍻
Does it do the magic, that I don’t have to write (:require [react])
? Because I see it works without it and with :exclusions [cljsjs/react cljsjs/react-dom]
So to import all this dependency I have to add them 1by1 to index.js?
(ns material-ui.core
(:require [reagent.core :as r]
["@material-ui/core/Styles" :refer [MuiThemeProvider createMuiTheme]]
;["@material-ui/core/Grid" :default Grid]
;["@material-ui/core/Paper" :default Paper]
;["@material-ui/core/AppBar" :default AppBar]
;["@material-ui/core/Toolbar" :default Toolbar]
;["@material-ui/core/Typography" :default Typography]
;["@material-ui/core/IconButton" :default IconButton]
;["@material-ui/core/Button" :default Button]
;["@material-ui/core/Drawer" :default Drawer]
;["@material-ui/core/TextField" :default TextField]
))
^shadow codebut then I will have super big js library instead of load only files which I need? I mean it will work like cljsjs, which will generate 2 MB js?
Should it look like import MaterialUIStyles from '@material-ui/core/Styles';
? Normally it will be probably something like this import {MuiThemeProvider createMuiTheme} from '@material-ui/core/Styles';
.
Not sure how to use it and require in ns
ERROR in ./src/js/index.js 3:25
Module parse failed: Unexpected token (3:25)
You may need an appropriate loader to handle this file type.
| import React from 'react';
| import ReactDOM from 'react-dom';
> import {MuiThemeProvider createMuiTheme} from '@material-ui/core/Styles';
So I can’t use {...}
Do you mean something like this import MaterialUIStyles from '@material-ui/core/Styles';
?
hmm now I have this
[Figwheel] Compile Warning target/public/cljs-out/dev/clojure/test/check/generators.cljc line:999 column:15
cljs.core/<=, all arguments must be numbers, got [#{nil js/Number} number] instead
994 ubexp (max -1023 (get-exponent upper-bound))]
995 (cond (<= 0.0 lower-bound)
996 (tuple (gen-exp lbexp ubexp)
997 (return 1.0))
998
999 (<= upper-bound 0.0)
^---
1000 (tuple (gen-exp ubexp lbexp)
1001 (return -1.0))
1002
1003 :else
1004 (fmap (fn [[exp sign :as pair]]
But it looks like different issue{:deps {org.clojure/clojure {:mvn/version "1.9.0"}
org.clojure/clojurescript {:mvn/version "1.10.339"}
reagent {:mvn/version "0.8.1" :exclusions [cljsjs/react cljsjs/react-dom]}
re-frame {:mvn/version "0.10.5"}
bidi {:mvn/version "2.1.3"}
venantius/accountant {:mvn/version "0.2.4"}
stylefy {:mvn/version "1.5.1"}
com.taoensso/timbre {:mvn/version "4.10.0"}
org.clojure/test.check {:mvn/version "0.9.0"}}
:paths ["src" "resources"]
:aliases {:fig {:extra-deps
{com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
com.bhauman/figwheel-main {:mvn/version "0.1.9"}}
:extra-paths ["target" "test"]}
:build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}
:min {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
:test {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" form-validator-demo.test-runner]}}}
In js it will be import {MuiThemeProvider createMuiTheme} from '@material-ui/core/Styles'
import React from 'react';
import ReactDOM from 'react-dom';
import MaterialStyles from '@material-ui/core/Styles';
window.React = React;
window.ReactDOM = ReactDOM;
window.MaterialStyles = MaterialStyles;
Sure but how to use it?
(ns material-ui.core
(:require [reagent.core :as r]
[material-styles]))
(def create-mui-theme material-styles/createMuiTheme)
(def mui-theme-provider (r/adapt-react-class material-styles/MuiThemeProvider))
but then webpack error https://clojurians.slack.com/archives/CALJ3BFLP/p1536931466000100
window.MaterialStyles = {createMuiTheme: createMuiTheme, MuiThemeProvider: MuiThemeProvider}
https://clojurescript.org/guides/webpack this one? it is too simple to show how to solve issues
I know this tutorial, but I don’t feel it really helps me to start be productive. To many unknown
yes, [material-styles :refer [createMuiTheme MuiThemeProvider]]
and material-styles/createMuiTheme
. Both work.
cool, thanks for that trick. To be consistent it is clj -A:fig -m figwheel.main -pc -b dev -r
import Grid from "@material-ui/core/Grid";
(:require [grid])
(def grid (r/adapt-react-class grid))
<- this line throw an error
Uncaught Error: Assert failed: Component must not be nil
<- I can’t figure out it. Any hints?
it works with shadow and require ["@material-ui/core/Grid" :default Grid]
(which is translated to import Grid from "@material-ui/core/Grid";
)
@bhauman: I've been working on getting figwheel-main hooked up with Integrant, it's working great with the api. Based on how Integrant works, I was wondering if it would make sense to have figwheel-start
return a map with the started configuration info? It`s pretty easy to work around but it seems like something that may be useful for other things as well.
@shaun-mahood The only worry there is the REPL experience
Oh yeah, that would not be ideal. Any issues with pulling from the build-registry directly?
@shaun-mahood do you have to store the data?
The build registry could perhaps be a dynamic binding, and then you could make this all integranty, but that has some ramifications that I’m not sure about
All I really need to do with it is to be able to stop and restart the currently running builds - so likely I could read it as part of the stop function. What I’m doing now is just passing the initial build id into a map, which works fine for me. I’ll experiment with reading the state on stop and see how that goes.
you could use ring/resources https://ring-clojure.github.io/ring/ring.middleware.resource.html
@bhauman https://github.com/Deraen/ring-cljsjs there is this 🙂
ring-cljsjs does some stuff to work around the fact that you want to serve from production/dev with different files.