vouch-opensource / krell

Simple ClojureScript React Native Tooling
Eclipse Public License 1.0
673 stars 37 forks source link

Getting error upon starting Krell repl - No such namespace: react #113

Closed bpringe closed 3 years ago

bpringe commented 3 years ago

This is using the instructions for Calva here: https://github.com/vouch-opensource/krell/wiki/Tooling-Integration---Emacs,-Cursive,-VSCode-etc.#calva-vs-code

No such namespace: react, could not locate react.cljs, react.cljc, or JavaScript source providing "react" in file file:/home/brandon/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/reagent/core.cljs

The only solution I've found that works is adding these foreign-libs to build.edn (found here):

 :foreign-libs
   [{:file "node_modules/react"
     :provides ["react"]}
    {:file "node_modules/react-dom"
     :provides ["react-dom"]}
    {:file "node_modules/react-native"
     :provides ["react-native"]}]

I also tried adding anaylize-path to the build.edn, as seen here, but this didn't fix the issue.

bpringe commented 3 years ago

Running clj -m krell.main -co build.edn -c -r works fine without having foreign-libs set, for what it's worth.

bpringe commented 3 years ago

I'm not sure if this is related, but having set :foreign-libs to the above, I'm now getting this error each time I start the krell repl, then start Metro, then npx react-native run-android.

Caused by: clojure.lang.ExceptionInfo: No such namespace: react-native, could not locate react_native.cljs, react_native.cljc, or JavaScript source providing "react-native" (Please check that namespaces with dashes use underscores in the ClojureScript file name) in file /home/brandon/.gitlibs/libs/io.vouch/reagent-react-native/54bf52788ab051920ed7641f386177374419e847/src/reagent/react_native.cljs {:tag :cljs/analysis-error}
swannodette commented 3 years ago

Loading React Native via :foreign-libs is not a supported use case. Calva needs to support cljs.main style REPLs.

PEZ commented 3 years ago

Has something changed with Krell since I wrote those instructions that would need any changes in Calva's REPL capabilities?

I'm trying to reproduce this, but get stuck when setting the Reagent tutorial up (#130).

However, my old test project for this still works with Calva. I think this issue should remain open until we know what the Calva instructions should be. If we find that something needs to be fixed in Calva, then of course we should open the issue on Calva instead. Does that make sense?

swannodette commented 3 years ago

I don't have time to chase downstream tooling. Krell provides a REPL that follows standard Clojure conventions so making it work elsewhere should not require any novelty. There might be other problems unrelated to Calva - and feel free to report those via new issues.

PEZ commented 3 years ago

I wasn't suggesting you chase them. 😄

Anyway. I just got it working. Since an update of Calva a while ago, the instructions for Calva are outdated on the wiki.

Outdated:

        "projectType": "Clojure CLI"

Should be:

        "projectType": "deps.edn",

Calva warns about this in a bit too subtle a way, it seems. We should add a more in-your-face error message about it. I also think it is time we make Krell a built-in option. Less instructions that can get wrong out there then.

Not sure this fixes @bpringe problem, but I'll find out.