npm-deps and nodejs repl

74 views
Skip to first unread message

Dusan Miloradovic

unread,
Oct 29, 2017, 3:11:30 AM10/29/17
to ClojureScript
When I try to run the clojurescript node repl for a leiningen project with npm-deps, I get the following error:

lein trampoline run -m clojure.main repl.clj

ClojureScript Node.js REPL server listening on 55620
To quit, type: :cljs/quit
cljs.user=> cljs.user=> (require 'mpgui.core)
clojure.lang.ExceptionInfo: No such namespace: xml2js, could not locate xml2js.cljs, xml2js.cljc, or JavaScript source providing "xml2js" in file /hom
e/dusan/maximoplus-gui/src/mpgui/core.cljs {:tag :cljs/analysis-error}
        at clojure.core$ex_info.invokeStatic(core.clj:4617)
        at clojure.core$ex_info.invoke(core.clj:4617)
        at cljs.analyzer$error.invokeStatic(analyzer.cljc:697)
        at cljs.analyzer$error.invoke(analyzer.cljc:693)
        at cljs.analyzer$error.invokeStatic(analyzer.cljc:695)
...

However, this works:

lein trampoline run -m clojure.main repl.clj
ClojureScript Node.js REPL server listening on 54333
To quit, type: :cljs/quit
cljs.user=> (in-ns 'mpgui.core)
nil
mpgui.core=> (load-namespace 'mpgui.core)
nil
mpgui.core=> xml2js
WARNING: Use of undeclared Var mpgui.core/xml2js at line 1 <cljs repl>
nil
mpgui.core=> (load-file "src/mpgui/core.cljs")
nil
mpgui.core=> xml2js
#js {:defaults #js {"0.1" #js {:explicitCharkey false, :trim true, :normalize true, :normalizeTags false, :attrkey "@", :charkey "#", :explicitArray f
alse, :ignoreAttrs false, :mergeAttrs false, :explicitRoot false, :validator nil, :xmlns false, :explicitChildren false, :childkey "@@", :charsAsChild
ren false, :includeWhiteChars false, :async false, :strict true, :attrNameProcessors nil, :attrValueProcessors nil, :tagNameProcessors nil, :valueProc
essors nil, :emptyTag ""}, "0.2" #js {:explicitCharkey false, :trim false, :normalize false, :normalizeTags false, :attrkey "$", :charkey "_", :explic
itArray true, :ignoreAttrs false, :mergeAttrs false, :explicitRoot true, :validator nil, :xmlns false, :explicitChildren false, :preserveChildrenOrder
 false, :childkey "$$", :charsAsChildren false, :includeWhiteChars false, :async false, :strict true, :attrNameProcessors nil, :attrValueProcessors ni
l, :tagNameProcessors nil, :valueProcessors nil, :rootName "root", :xmldec #js {:version "1.0", :encoding "UTF-8", :standalone true}, :doctype nil, :r
enderOpts #js {:pretty true, :indent "  ", :newline "\n"}, :headless false, :chunkSize 10000, :emptyTag "", :cdata false}}, :processors #js {:normaliz
e #object[Function], :firstCharLowerCase #object[Function], :stripPrefix #object[Function], :parseNumbers #object[Function], :parseBooleans #object[Fu
nction]}, :ValidationError #object[ValidationError], :Builder #object[Builder], :Parser #object[Parser], :parseString #object[Function]}


Any ideas why this works, and the first example doesn't? I am using clojurescript 1.9.946

Thanks

Reply all
Reply to author
Forward
0 new messages