Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new JS component and restarting the REPL leads to: Can't find variable: cljs #1

Open
Zeniten opened this issue Jun 6, 2022 · 0 comments

Comments

@Zeniten
Copy link

Zeniten commented Jun 6, 2022

Steps

  1. Add a new component in js/.

  2. Require the component in cljs file:

    (def foo (r/adapt-react-class (.-default (js/require "../js/Foo.js"))))
  3. Restart the REPL:

    clj -M -m krell.main -co build.edn -c -r
  4. Refresh Metro.

Result

Leads to this:

info Reloading app...
 BUNDLE  ./index.js 

 LOG  Running "AProject" with {"rootTag":11}
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method. 
KrellRoot@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aproject&modulesOnly=false&runModule=true:1389:36
RCTView
View
RCTView
View
AppContainer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aproject&modulesOnly=false&runModule=true:79807:36
AProject(RootComponent)@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aproject&modulesOnly=false&runModule=true:86187:28
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method. 
KrellRoot@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aproject&modulesOnly=false&runModule=true:1389:36
RCTView
View
RCTView
View
AppContainer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aproject&modulesOnly=false&runModule=true:79807:36
AProject(RootComponent)@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aproject&modulesOnly=false&runModule=true:86187:28
 LOG  Krell sez howdy, Device ID: msmnile
 LOG  Connected to Krell REPL Server
 ERROR  Could not evaluate form: (cljs.core._STAR_print_namespace_maps_STAR_ = true) [ReferenceError: Can't find variable: cljs]
 LOG  Closed connection with {"address": "10.0.0.2", "family": "IPv4", "port": 38771}

And this, in the REPL window:

zeniten@ztn2:~/repositories/AProject$ yarn cljs:repl
yarn run v1.22.4
$ clj -M -m krell.main -co build.edn -c -r
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 further details.

Waiting for device connection on port 5001
ClojureScript 1.10.844
cljs.user=> clojure.lang.ExceptionInfo: Unexpected error during REPL initialization #:cljs.repl{:error :init-failed}
  at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:1220)
  at cljs.repl$repl_STAR_.invoke(repl.cljc:1033)
  at cljs.cli$repl_opt.invokeStatic(cli.clj:325)
  at cljs.cli$repl_opt.invoke(cli.clj:312)
  at cljs.cli$default_compile.invokeStatic(cli.clj:534)
  at cljs.cli$default_compile.invoke(cli.clj:486)
  at krell.repl$krell_compile.invokeStatic(repl.clj:243)
  at krell.repl$krell_compile.invoke(repl.clj:233)
  at cljs.cli$compile_opt.invokeStatic(cli.clj:542)
  at cljs.cli$compile_opt.invoke(cli.clj:540)
  at cljs.cli$main.invokeStatic(cli.clj:703)
  at cljs.cli$main.doInvoke(cli.clj:692)
  at clojure.lang.RestFn.applyTo(RestFn.java:139)
  at clojure.core$apply.invokeStatic(core.clj:669)
  at clojure.core$apply.invoke(core.clj:662)
  at cljs.main$_main.invokeStatic(main.clj:65)
  at cljs.main$_main.doInvoke(main.clj:56)
  at clojure.lang.RestFn.applyTo(RestFn.java:137)
  at clojure.core$apply.invokeStatic(core.clj:667)
  at clojure.core$apply.invoke(core.clj:662)
  at krell.main$_main.invokeStatic(main.clj:9)
  at krell.main$_main.doInvoke(main.clj:7)
  at clojure.lang.RestFn.applyTo(RestFn.java:137)
  at clojure.lang.Var.applyTo(Var.java:705)
  at clojure.core$apply.invokeStatic(core.clj:667)
  at clojure.main$main_opt.invokeStatic(main.clj:514)
  at clojure.main$main_opt.invoke(main.clj:510)
  at clojure.main$main.invokeStatic(main.clj:664)
  at clojure.main$main.doInvoke(main.clj:616)
  at clojure.lang.RestFn.applyTo(RestFn.java:137)
  at clojure.lang.Var.applyTo(Var.java:705)
  at clojure.main.main(main.java:40)
Caused by: clojure.lang.ExceptionInfo: ReferenceError: Can't find variable: cljs {:type :js-eval-exception, :error {:status :exception, :value "ReferenceError: Can't find variable: cljs"}, :repl-env #krell.repl.KrellEnv{:options {:port 5001, :watch-dirs ["src"], :connect-timeout 30000, :eval-timeout 30000, :recompile :direct, :main aproject.core, :output-dir "target"}, :file-index #object[clojure.lang.Atom 0x77a14911 {:status :ready, :val {#object[java.io.File 0x541c76fd "/home/zeniten/repositories/AProject/src"] 1654452681422, #object[java.io.File 0x1142843c "/home/zeniten/repositories/AProject/src/aproject"] 1654507507401, #object[java.io.File 0x3993cecb "/home/zeniten/repositories/AProject/src/aproject/core.cljs"] 1654507507389}}], :socket #object[clojure.lang.Atom 0x4407f129 {:status :ready, :val {:socket #object[java.net.Socket 0x731bdcca "Socket[addr=/10.0.0.2,port=38771,localport=5001]"], :in #object[java.io.BufferedReader 0x76fdd5f1 "java.io.BufferedReader@76fdd5f1"], :out #object[java.io.BufferedWriter 0x513fb873 "java.io.BufferedWriter@513fb873"]}}], :state #object[clojure.lang.Atom 0x2a4a95c4 {:status :ready, :val {:watcher #object[io.methvin.watcher.DirectoryWatcher 0x71ae1cb "io.methvin.watcher.DirectoryWatcher@71ae1cb"], :done true}}]}, :form (set! cljs.core/*print-namespace-maps* true), :js "(cljs.core._STAR_print_namespace_maps_STAR_ = true)"}
  at cljs.repl$evaluate_form.invokeStatic(repl.cljc:577)
  at cljs.repl$evaluate_form.invoke(repl.cljc:498)
  at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:1129)
  ... 31 more
Done in 142.00s.

Other information

OS: Ubuntu 20.04
Target: Android (physical device)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant