Closed samsmo closed 9 years ago
I seem to have this problem if I put the clojurescript and om dependencies in my "dev" profile.
:profiles {:dev {:dependencies [[org.clojure/clojurescript "0.0-2740"]
[org.omcljs/om "0.8.7"]]}}
You can reproduce the problem using lein new mies-om hello-world
and moving those deps down to the profile and the following repl stuff:
(require
'[cljs.repl :as repl]
'[cljs.repl.browser :as browser])
(repl/repl* (browser/repl-env)
{:output-dir "out"
:optimizations :none
:cache-analysis true
:source-map true})
via:
lein trampoline with-profile dev run -m clojure.main browser_repl.clj
The reason I use the profile is that I run my apps from a self-hosted http-kit instance via an uberjar, rather than just compile the client and serve it up via some other web server. I move those deps to the :dev
profile so that they're not included in the uberjar
.
I'm retracting the above comment.
I've tried a variety of combinations, and they all work, as long as I remove the .repl...
directories before trying again.
I tried setting "cache-analysis" to false, but no difference.
If I use:
lein trampoline run -m clojure.main browser_repl.clj
more than once without rm -rf .repl-0.0-2740
I get the cljsjs.react error:
=> lein trampoline run -m clojure.main browser_repl.clj
Compiling client js ...
Waiting for browser to connect ...
To quit, type: :cljs/quit
Exception in thread "main" clojure.lang.ExceptionInfo: No such namespace: cljsjs.react at line 1
file:/Users/keith/.m2/repository/org/omcljs/om/0.8.7/om-0.8.7.jar!/om/dom.cljs
{:tag :cljs/analysis-error,
:file "file:/Users/keith/.m2/repository/org/omcljs/om/0.8.7/om-0.8.7.jar!/om/dom.cljs",
:line 1,
:column 1},
compiling:(/Users/keith/Desktop/hello-world/browser_repl.clj:3:35)
I don't have to delete the complete .repl-0.0-2740
directory, just:
.repl-0.0-2740/client.js
That has to be done before each invocation of the browser_repl.clj
as recommended in the cljs docs.
Something is probably calling cljs.repl/analyze-source
, in my case it was Weasel. I worked around this issue by turning it into a warning instead of this breaking exception:
https://github.com/darwin/weasel/commit/c2b5b963bcf10a7c341a4cbc8f21121d3adef6b0
I was able to diagnose my issue by printing last stack trace with help of this article: http://tech.puredanger.com/2010/02/17/clojure-stack-trace-repl
Ready? Go!
I have commented out [cljsjs.react] from om.dom and om.core in ~ /.m2/repository/org/omcljs/om/0.8.7/om-0.8.7.jar, then my om app worked fine.
(ns om.core
(:require ;;[cljsjs.react]
[om.dom :as dom :include-macros true]
[goog.dom :as gdom])
(:import [goog.ui IdGenerator]))
(ns om.dom
(:refer-clojure :exclude [map meta time])
(:require-macros [om.dom :as dom])
(:require ;;[cljsjs.react]
[goog.object :as gobject]))
This was a ClojureScript issue not an Om one. It has been addressed in ClojureScript master.
I've been trying to follow along with the basic om tutorial and I haven't had much luck getting Light Table to evaluate any of the code (
No such namespace: cljsjs.react at line 1
error), so I figured it was something wonky with Light Table... I then spun up a native cljs REPL by following the Running REPLs guide and still can't seem to get the REPL to recognize the cljsjs/React namespace.Running the repl via
lein trampoline run -m clojure.main repl.clj
and inputting:(ns om-tut.core (:require [om.core :as om :include-macros true] [om.dom :as dom :include-macros true]))
yields:Here's my
lein dep :tree
ouput