Fork me on GitHub
#leiningen
<
2017-11-15
>
derpocious02:11:05

hey guys, I 'm trying to load up a cljs namespace in the repl, but I'm getting errors. I'm trying to follow the video on this page: https://medium.com/@roman01la/how-to-create-clojurescript-app-4e38778c4762

derpocious02:11:36

I have a cljs file that looks like this:

(ns my-service-cljs.core)
(defn derp [x]
  x)

derpocious02:11:52

It's named core.cljs in a folder name my_service_cljs

derpocious02:11:24

I load up a lein repl and enter (in-ns 'my-service-cljs.core)

derpocious02:11:40

And it returns #object[clojure.lang.Namespace 0x58d3f46a "my-service-cljs.core"]

derpocious03:11:01

I'm not sure if that means it worked because it seem like if I type in anything it's that same output.

derpocious03:11:45

When I try to call derp some something like (derp 5) it returns this error:

CompilerException java.lang.RuntimeException: Unable to resolve symbol: derp in this context, compiling:(/private/var/folders/41/b5ntx4mn2mv9qk3jyxnsnk_w0000gn/T/form-init7264055216539684302.clj:1:1) 

noisesmith03:11:48

@derpocious in-ns doesn't load namespaces - it creates them if they don't exist yet, but it does not load the file. you should use require first

derpocious04:11:57

thanks @noisesmith, when I do (require 'my-service-cljs.core) I then get this error message:

CompilerException java.lang.RuntimeException: Unable to resolve symbol: require in this context, compiling:(/private/var/folders/41/b5ntx4mn2mv9qk3jyxnsnk_w0000gn/T/form-init7264055216539684302.clj:1:1) 

derpocious04:11:10

is this the proper syntax?

noisesmith04:11:00

when a namespace is auto-generated by in-ns, it doesn't know about clojure.core, you can fix it with (clojure.core/refer-clojure) then require again

derpocious05:11:00

Hmm the results doesn't seem to be any different after I run clojure.core/refer-clojure)

derpocious12:11:01

Is there anything else I can try? 🙂

foobar13:11:06

I get Tried to use insecure HTTP repository without TLS, how do I find out which dep is causing it?

foobar13:11:46

Ok, seems like trial and error is the only way

gonewest81814:11:05

@derpocious can you show the transcript from the repl session in a github gist or something?

derpocious15:11:34

@gonewest818 there's not much more to it than the error message I posted

gonewest81815:11:24

Are you in the CLJS repl or the clojure one? Is the path to the file src/my_service_cljs/core.clj?

gonewest81815:11:47

Have you changed the project.clj file in any way after the lein-figwheel auto generated it?