calva
calva copied to clipboard
Calva Error "LSP classpath lookup failed when running `lein with-profile +test,+dev classpath`. "
I would like to use vs code as development environment for clojure.
I'm opening guestbook project in vs code.
As soon as the project is opened in vs code I get error pop up.
LSP classpath lookup failed when running `lein with-profile +test,+dev classpath`. Some features may not work properly if ignored. Error: Cannot run program "lein" (in directory "/Users/rnatarajan/Documents/Coding/others/clj-web-dev/c01/guestbook"): error=2, No such file or directory Choose an option:
Screenshot here
I'm also getting below details in VS code output -
Calva is utilizing cider-nrepl and clojure-lsp to create this VS Code experience.
nREPL dependencies configured:
nrepl: 1.0.0
cider-nrepl: 0.28.5
cider/piggieback: 0.5.3
clojure-lsp version configured: latest
If you are new to Calva, please see: https://calva.io/getting-started/
And please consider the command: **Calva: Fire up the Getting Started REPL**
Calva version used: v2.0.350
Same question I've asked in stackoverflow as well
Welcome to Calva!
What I'm pretty sure is happening is you don't have lein
installed and/or on your system path. That project contains a project.clj file, which means it's intended to be used with Leiningen. Once you install Leiningen (lein
), and add it to your path, reload the VS Code window (if it's still open), and you should no longer see that error.
You're getting that error because Calva uses clojure-lsp for static code analysis features. When clojure-lsp is starting up for that project, it's trying to run that lein
command in your screenshot to get some info it uses.
Let me know if the above suggestion works for you or if you have any further troubles.
@bpringe
which lein
returns /Users/rnatarajan/.sdkman/candidates/leiningen/current/bin/lein
and echo $PATH
returns
/Users/rnatarajan/.cabal/bin:/Users/rnatarajan/.ghcup/bin:/Users/rnatarajan/.sdkman/candidates/sbt/current/bin:/Users/rnatarajan/.sdkman/candidates/maven/current/bin:/Users/rnatarajan/.sdkman/candidates/leiningen/current/bin:/Users/rnatarajan/.sdkman/candidates/java/current/bin:/Users/rnatarajan/.sdkman/candidates/gradle/current/bin:/Users/rnatarajan/.elixir-ls/:/Users/rnatarajan/Library/Python/3.9/bin:/Users/rnatarajan/Documents/Coding/ekata/home-bin:/Users/rnatarajan/.bin:/opt/homebrew/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.1/shims:/Users/rnatarajan/.pyenv/shims:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/rnatarajan/.cargo/bin:/Users/rnatarajan/Library/Application Support/Coursier/bin:/Users/rnatarajan/Library/Application Support/Coursier/bin:/Users/rnatarajan/.roswell/bin
The lein /Users/rnatarajan/.sdkman/candidates/leiningen/current/bin
is already in the PATH.
Not sure if I miss anything
Hmm. Sometimes even though something is on your path in your terminal, it's not found in an integrated VS Code terminal when you open VS Code outside of that terminal (like by clicking the application). I'm not positive that's what's going on here since clojure-lsp is a separate process that's trying to run lein
, but when you're in VS Code, can you run lein with-profile +test,+dev classpath
successfully?
If not, try opening VS Code from a terminal where lein
is found, using code <relative path to project directory>
, and see if the problem persists.
Also, if the problem persists, please copy and paste the contents of your clojure-lsp server log here. CC @ericdallo
I don't know how to get clojure-lsp server logs.
I've lein installed and accessible via konsole.
I opened the vs code from same konsole via command open -a /Applications/Visual\ Studio\ Code.app
. Still I get the same error.
The calva open lsp log provides only the below info which I think is not useful. I have enabled the verbose mode as well.
Welcome to Calva. Happy Clojure and ClojureScript coding! ❤️
Please check these resources out:
Calva Documentation: https://calva.io/
#calva at the Clojurians Slack: https://clojurians.slack.com/messages/calva/
Bug reports: https://github.com/BetterThanTomorrow/calva/issues
If you like Calva, please consider how you can contribute: https://github.com/BetterThanTomorrow/calva/wiki/How-to-Contribute
Calva is utilizing cider-nrepl and clojure-lsp to create this VS Code experience.
nREPL dependencies configured:
nrepl: 1.0.0
cider-nrepl: 0.28.5
cider/piggieback: 0.5.3
clojure-lsp version configured: latest
If you are new to Calva, please see: https://calva.io/getting-started/
And please consider the command: **Calva: Fire up the Getting Started REPL**
Calva version used: v2.0.388
That's a bug. It should open the clojure-lsp log file. But you can open it manually. If you use the Show Server Info command instead, you should see the log-path
printed (amongst a lot of other info), something like:
"log-path": "/tmp/clojure-lsp.out",
Then you can open this in VS Code from the command line. For the above path:
code /tmp/clojure-lsp.out
Thanks @PEZ
Here is the clojore-lsp server log.
2023-09-01T21:32:15.696Z INFO [clojure-lsp.server:596] - [SERVER] Starting server... 2023-09-01T21:32:15.700Z DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start... 2023-09-01T21:32:15.702Z INFO [clojure-lsp.server:483] - Initializing... 2023-09-01T21:32:15.933Z INFO [clojure-lsp.db:77] - [DB] Reading transit analysis cache from /Users/rnatarajan/Documents/Coding/others/again/.lsp/.cache/db.transit.json db took 228ms 2023-09-01T21:32:15.939Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 6ms 2023-09-01T21:32:15.947Z INFO [clojure-lsp.classpath:103] - Finding classpath via
lein with-profile +test,+dev classpath
2023-09-01T21:32:15.949Z ERROR [clojure-lsp.classpath:130] - Error while looking up classpath info in /Users/rnatarajan/Documents/Coding/others/again. Error: Cannot run program "lein" (in directory "/Users/rnatarajan/Documents/Coding/others/again"): error=2, No such file or directory 2023-09-01T21:48:55.950Z INFO [clojure-lsp.server:154] - {:message "Classpath lookup failed when runninglein with-profile +test,+dev classpath
. Some features may not work properly.", :type :error, :extra "Cannot run program "lein" (in directory "/Users/rnatarajan/Documents/Coding/others/again"): error=2, No such file or directory"} 2023-09-01T21:48:55.962Z INFO [clojure-lsp.startup:261] - [Startup] Analyzing source paths for project root /Users/rnatarajan/Documents/Coding/others/again 2023-09-01T21:48:55.968Z INFO [clojure-lsp.startup:74] - [Startup] Project only paths analyzed by clj-depend, took 0ms 2023-09-01T21:48:55.978Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 0ms 2023-09-01T21:48:55.984Z INFO [clojure-lsp.kondo:230] - Linting whole project for unused-public-var took 6ms 2023-09-01T21:48:55.984Z WARN [clojure-lsp.kondo:355] - Non-fatal error from clj-kondo: No configs copied.
But I doesn'tn't say why I doesn't find lein though
@rajcspsg are you on windows? we have this custom logic to convert the command to use powershell, maybe could be related?
ah nvm, the log says it's running lein with-profile +test,+dev classpath
indeed
if lein is really on PATH, it should work