technomancy / grenchman

Sorry about the name
GNU General Public License v3.0
217 stars 8 forks source link

confusing error messages. #18

Closed winks closed 10 years ago

winks commented 10 years ago
$ lein trampoline repl :headless 
nREPL server started on port 38457 on host 127.0.0.1
$ lein version
Leiningen 2.3.0 on Java 1.7.0_25 OpenJDK 64-Bit Server VM

so far so good

$ ~/bin/grench-0.2.0-debian-7 eval '(println "hi")' 
Couldn't read port from .nrepl-port or $GRENCH_PORT.
$ GRENCH_PORT=38457 ~/bin/grench-0.2.0-debian-7 eval '(println "hi")'
hi

ok

$ ~/bin/grench-0.2.0-debian-7 lein version 
Couldn't read port from ~/.lein/repl-port or $LEIN_REPL_PORT.

If Leiningen is not running, launch `lein repl :headless' from outside a
project directory and try again.
$ LEIN_REPL_PORT=38457 ~/bin/grench-0.2.0-debian-7 lein version
  Unknown status: 19:namespace-not-found
  Unknown status: 5:error

o_O

So, to sum it up

Upgrading to leiningen 2.3.3 did not help, btw.

technomancy commented 10 years ago

OK, so the main issue here is that you need two separate servers; one for project code and one for lein tasks. What you're doing is trying to re-use the project server as a Leiningen server, which doesn't work because your project doesn't know about Leiningen's namespaces.

The second example should work without setting GRENCH_PORT if you run grench from within the project dir.

But yeah, the error messages could probably be clearer here. Open to suggestions as to wording.

winks commented 10 years ago

Ok, thanks - that clears it up somewhat. But the headless repl I started was inside a project dir - so what you explained sounded exactly the other way round.

When I run

lein repl :headless

and in the same dir

~/bin/grench-0.2.0-debian-7 eval '(println 23)'

then I still need GRENCH_PORT=1234

So basically running clojure code is fine, but I can't get lein to work over grench - at all, with any task

technomancy commented 10 years ago

Ok, I see that you're running Leiningen 2.3.0. You need 2.3.3 for Grenchman.

winks commented 10 years ago

OK, so I changed nothing and I got it to work somehow.

technomancy commented 10 years ago

Right; launching a repl inside your project should not allow grench lein to work, because how would your project know what to do with Leiningen tasks?

winks commented 10 years ago

Yeah, now I got it. I have no clue how, but I totally misunderstood http://leiningen.org/grench.html versus what I had learnt from IRC earlier - maybe my expectations were completely off.

So maybe the only thing is missing is a "why should I use it" paragraph on that page. Basically like the repo README.

Case closed, all is fine.

Thanks for your patience :)

(But it really did misbehave at the start, still confused a little)