figwheel-main
figwheel-main copied to clipboard
Windows 10 repl doesn't connect to the browser
I am trying to follow the tutorial and don't get the prompt when running the figwheel-main repl.
A) with leiningen:
lein trampoline run -m figwheel.main
B) without leiningen
clj -m figwheel.main
I get the same output:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for f
urther details.
[Figwheel] Compiling build figwheel-default-repl-build to "target\p
ublic\cljs-out\figwheel-default-repl-build-main.js"
[Figwheel] ?[32mSuccessfully compiled build figwheel-default-repl-b
uild to "target\public\cljs-out\figwheel-default-repl-build-main.js
" in 44.886 seconds.?[0m
[Figwheel] Starting Server at http://localhost:9500
[Figwheel] Starting REPL
?[1mPrompt will show when REPL connects to evaluation environment (
i.e. a REPL hosting webpage)?[0m
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel aut
obuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder
focused on ids
(figwheel.main/reset) ;; stops, cleans, rel
oads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one
time
(figwheel.main/clean id ...) ;; deletes compiled c
ljs target files
(figwheel.main/status) ;; displays current s
tate of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the curre
nt connections
(figwheel.repl/focus session-name) ;; choose which sessi
on 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
[Rebel readline] Type :repl/help for online help info
Opening URL http://localhost:9500
The browser automatically opens, but the green "connected" logo doesn't appear.
This is the output of the browser console:
cljs_deps.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
base.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
deps.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
cljs_deps.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
(index):109 ClojureScript could not load :main, did you forget to specify :asset-path?
(anonymous) @ (index):109
(index):109 Uncaught ReferenceError: goog is not defined
at (index):109
(index):109 Uncaught ReferenceError: goog is not defined
at (index):109
(index):109 Uncaught ReferenceError: goog is not defined
at (index):109
(index):109 Uncaught ReferenceError: goog is not defined
at (index):109
(index):109 Uncaught ReferenceError: goog is not defined
at (index):109
:9500/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
This is an extract of the page source:
<html>
<body>
<!--StartFragment-->
document.write('<script src="target\public\cljs-out\figwheel-default-repl-build/goog/deps.js"><\/script>');
--
| document.write('<script src="target\public\cljs-out\figwheel-default-repl-build/cljs_deps.js"><\/script>');
| document.write('<script>if (typeof goog == "undefined") console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?");<\/script>');
| document.write('<script>goog.require("figwheel.repl.preload");<\/script>');
| document.write('<script>goog.require("devtools.preload");<\/script>');
| document.write('<script>goog.require("figwheel.main.system_exit");<\/script>');
| document.write('<script>goog.require("process.env");<\/script>');
| document.write('<script>goog.require("figwheel.repl.preload");<\/script>');
<!--EndFragment-->
</body>
</html>
Part of the problem seems to come from the mix use of backslashes instead of forward slashes in the script paths.
I use git-sdk-64 as Linux replacement / bash environment. Sidenote: I am able to run a shadow-cljs hello-world with a cljs-repl in that environment.
Seems to be linked to this issue.
I haven't been able to set figwheel up on my Windows 10 machine so I can't say for sure, but I strongly suspect you are on the right lines that it is related to the forward-slash / backslash difference between Windows and *nix.
If you run the following you should see the full config for the dev build which figwheel uses:
lein trampoline run -m figwheel.main -pc -b dev
where -pc
is short for --print-config
, and I assume your build is defined in dev.cljs.edn
.
This gives some very useful information, and you should check the values of the keys :output-to
and :output-dir
.
The strange thing about what you have posted is the target\public\
appearing in the
{,,,
:output-dir "target\public\cljs-out"
:output-to "target\public\cljs-out\dev-main.js"
},,,
(or whatever you compiled .js file should be called, which is what the index.html is expecting.)
This may help, or perhaps provide some clue, but unless I have the environment in front of me it's very difficult to debug.