I experience the following error:
CompilerException java.lang.RuntimeException: No such var: user/help, compiling:(/private/var/folders/xy/8l2mmnsj0gv3myj72y0s2kmr0000gn/T/form-init6632573911186472967.clj:1:10884)
#<Namespace user>
Error loading namespace; falling back to user
This only happens in this one project. The project happily compiles to uberjar, and lein run works just fine, it's only the repl that doesn't work.
Anyone have any idea what this could be about?
The entire project is available at https://github.com/Skinney/coc-helper
I stumbled upon this question because I had the same problem. I have opened an issue for that problem, with minimal reproducing project and workaround, on the Leiningen github project.
Since the OP has apparently already solved the problem, here is the TL;DR for anyone else arriving here: the problem is that you require :as user in the main namespace. Changing the alias solves the problem, as the OP has done in this commit.
Related
See an error message: error in process sentinel: Could not start nREPL server: That’s not a task. Use "lein help" to list all tasks.
In the *Messages* buffer, the full form of the error is:
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: That’s not a task. Use "lein help" to list all tasks.
M-x cider-version shows
CIDER 0.15.0snapshot (package: 20170525.255)
Tried fiddling around with ~/.lein/profiles.clj to explicitly add in
{:user {:plugins [[cider/cider-nrepl "0.15.0snapshot"]]}}`
... but that didn't change anything.
(getting back to Clojure after a while with a "fresh" install (Emacs, clojure-mode, cider, etc. so might have missed some small environment setup step, just don't know what that is!)
Turns out the incompatibility was not with the nRepl middleware, but with Leiningen itself.
Once I uninstalled the version I had installed using apt-get, and self-installed using the downloaded script, and made sure this new version was what which lein led to, this problem went away.
More details: Running cider-jack-in was triggering a call to lein update-in with further arguments, but the version of Leiningen I had simply didn't show update-in as one of the options when I ran lein help.
When I add :repl-options {:init (print "x..")} to ~/.lein/profiles.clj it does what it should on every repl start-up. however, when I add the same to my local project.clj, I receive this error:
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: do in this context, compiling:(/tmp/form-init5885833654225579206.clj:1:886)
I'm using leiningen 2.5.3
I've stumbled across this issue as well - I tried to use multiple profiles, each with its own :repl-options.
The issue is that Leiningen doesn't merge `:init: correctly. You can refer to this issue for more details.
Unfortunately, I couldn't find any fix that would work for me. And the issue itself won't be fixed till Leiningen 3.0.
I just ran "lein new compojure-app guestbook" following the book "Web Development with Clojure". In one step the book is connecting to my Clojure project with light table. However when I try this I get the following error that makes no sense to me.
Here is the error I'm getting
Your Error
For the search engines, here is a copy of the pertinent part of your error:
Error loading lighttable.nrepl.handler: java.lang.RuntimeException: Unable to resolve var: reader/*alias-map* in this context
The Cause
Lighttable has upgraded to using a newer tools.reader.
I found two resources:
An applicable github issue that you might find helpful.
A forum thread covering the question (mentioned in the github issue above).
The Summarized Solution
Several people have solved this by simply running lein clean in their project directory.
If lein clean does not solve it for you, then here is the extended solution from the forum:
In project.clj. Replace
[compojure “1.1.6”]
with
[compojure “1.1.6” :exclusions [org.clojure/tools.reader]]
and add to the :dependencies list
[org.clojure/tools.reader “0.7.10”]
The reason seems to be that LightTable expects this version of
tools.reader, but Compojure brings in version 0.7.3
After employing this solution, you may wish to run lein clean again.
I recently decided to start using Slime/Swank for writing Clojure. I installed Incanter, Clojure, Slime and Swank yesterday by following this blogpost to the letter, which worked fine. However, I'm experiencing a problem getting Slime to find directories and files on the classpath. I'm running Slime using lein swank and slime-connect in Aquamacs on OS X 10.6. I have two questions:
1) I set up a small project to build a game of life simulation. I have a file called grid.clj from doing this earlier, which I put in the project's lib directory. In core.clj I put the following
(ns gof.core
(:require grid))
(def w (grid.make_grid 8))
Doing C-x C-e after this piece of code gives this error message in the repl:
Could not locate grid__init.class or grid.clj on classpath:
[Thrown class java.io.FileNotFoundException]
so I looked at my classpath using
(doseq [p (.getURLs (java.lang.ClassLoader/getSystemClassLoader))] (println (.getPath p)))
which produced this:
/Users/zjanes/Documents/gof/test/
/Users/zjanes/Documents/gof/test-resources
/Users/zjanes/Documents/gof/src/
/Users/zjanes/Documents/gof/classes/
/Users/zjanes/Documents/gof/resources
/Users/zjanes/Documents/gof/lib/clojure-1.3.0.jar
/Users/zjanes/Documents/gof/lib/grid.clj
/Users/zjanes/.lein/plugins/swank-clojure-1.3.4.jar
nil
user>
It seems to me that grid.clj is on this classpath, so why am I getting the error message?
2) In trying to solve this I had a look at clojure-1.3.0.jar and couldn't find anything that looks like it comes from clojure.contrib. Is contrib not included when installing clojure as described above?
I'm sure it's obvious I'm a complete novice with clojure, so the clearer the answer, and the less presumed knowledge, the better.
For completeness, I've looked at these answers (1 2 3) and this page, plus some googling around.
Thanks in advance
that tutorial is from 2009 and as far as I can tell it can't be made to work using those instructions.
Clojure contrib has been split up into many sub projects in clojure 1.3 so it no longer exits under that name.
in general clojure namespaces now have two parts, for instance:
(ns gof.core
(:require [incanter.grid])
I installed and run lein, but it seems to slow on My Mac (10.6.4).
Running 'time lein help' gives me
real 11m8.674s
user 0m54.297s
sys 1m32.621s
I tried once more.
real 15m25.560s
user 1m36.087s
sys 2m52.745s
What's wrong with this? Is anyone experiencing similar problem? Is there anyway to check what's the problem?
Added
When I install, I used 'sudo lein deps', as I got some errors using 'lein deps'. I guess it caused some problem accessing files. When I run 'sudo lein SOMETHING', it works as usual.
One thing to note is that it will put the src directory on the classpath. If you run it from $HOME and have a 54GB ~/src directory like I do, the JVM will slow to a crawl just trying to find the basic things.
It's because of how it looks for hooks. It's explained here: http://groups.google.com/group/clojure/browse_thread/thread/e04ab3f6e17f85c4.
You could give cake a try. It worked out of the box for my simple project.clj without any changes, and is blazing fast because of the persistent JVM it uses.
Found solution
sudo lein uses different CLASSPATH than that with just lein. I guess my CLASSPATH that contains clojure or clojure-contrib conflicted with the lein.
When I added this code at line 126 of lein, the problem is gone.
CLASSPATH="/Users/smcho/.m2/repository/leiningen/leiningen/1.2.0/leiningen-1.2.0-standalone.jar:lib/dev/swank-clojure-1.2.1.jar::src/:"
For uninstalling/installing, I asked and got an answer here.