Hi all, I am new to clojrue and clojurescript. I am trying to setup a SPA web app using helix, shandow-cljs & deps.edn. but when I try to run the app I am getting following error. I am using the latest version of clojure (1.12.1.1550) and clojurescript (1.12.42). I am using vscode with Calva REPL.
File: jar:file:/home/user/.m2/repository/org/clojure/clojurescript/1.12.42/clojurescript-1.12.42.jar!/cljs/pprint.cljs:9:1
--------------------------------------------------------------------------------
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (ns cljs.pprint
-------^------------------------------------------------------------------------
Invalid :refer, var cljs.core/IWriter does not exist
--------------------------------------------------------------------------------
10 | (:refer-clojure :exclude [deftype print println pr prn float?])
11 | (:require-macros
12 | [cljs.pprint :as m :refer [with-pretty-writer getf setf deftype
13 | pprint-logical-block print-length-loop
--------------------------------------------------------------------------------
that is odd. that var most definitely exists. I suspect something weird in your classpath and a rogue cljs.core ns hiding somewhere?
Could it be due to the compilation output dir being on the classpath?
I have checks for that, so doubtful
Thank you guys for the reply, I fixed the issue, I had a created cljs/core.cljs file in directory inside src. when I renamed it to app.cljs it started working. But I didn't understand why that was the issue.
namespaces are supposed to be unique. so you effectively overwrote the cljs.core that comes with cljs. best to pick a unique enough prefix. anyhing cljs.* should be considered reserved
I see
another issue I am facing (and have faced randomly in past) is that the vs code calva extension is stuck when waiting for shadow-cljs to complete even after shado-cljs has compiled.
Stuck here
well did you open your app in the browser? or whatever you are targetting?
yes, I did now but that didn't help. let me jack-in again.
look at the browser console. there should be a "shadow-cljs ready" message
Now after restarting vscode. I am getting this error:
ExceptionInfo: already started
Seems like exiting (killing?) VSCode did not stop the original shadow-cljs process. Try killing all related processes via your task manager, whatever it might be.
yes right, I had same thought, I killed all running clojure process. now it the calva started processing.
Finally it's working now. There were 2 issues, 1. I had wrong path of js file in index.html and 2. I was not opening the app in the browser, which is why the jack-in was not completing. Thank you guys for your help.