Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by
{code:|title=Starting a REPL with both `:npm-deps` and `:foreign-libs`}
clj -Sdeps "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.339\"}}}" -m cljs.main -co "{:npm-deps {left-pad \"1.3.0\"} :install-deps true :foreign-libs [{:file \"https://apis.google.com/js/platform.js\" :provides [\"google.api\"] :global-exports {google.api gapi}}]}" -r

{code:|title=Requiring the `:foreign-libs` library after the `:npm-deps` dependency fails}
cljs.user=> (require '[left-pad])
cljs.user=> (require '[google.api])
java.io.FileNotFoundException: /home/garrett/https:/apis.google.com/js/platform.js (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at cljs.util$last_modified.invokeStatic(util.cljc:224)
        at cljs.util$last_modified.invoke(util.cljc:216)
        at cljs.util$changed_QMARK_.invokeStatic(util.cljc:232)
        at cljs.util$changed_QMARK_.invoke(util.cljc:231)
        at cljs.closure$handle_js_modules$fn__5877.invoke(closure.clj:2670)
        at clojure.core$some.invokeStatic(core.clj:2693)
        at clojure.core$some.invoke(core.clj:2684)
        at cljs.closure$handle_js_modules.invokeStatic(closure.clj:2667)
        at cljs.closure$handle_js_modules.invoke(closure.clj:2633)
        at cljs.repl$evaluate_form.invokeStatic(repl.cljc:508)
        at cljs.repl$evaluate_form.invoke(repl.cljc:484)
        at cljs.repl$eval_cljs.invokeStatic(repl.cljc:672)
        at cljs.repl$eval_cljs.invoke(repl.cljc:665)
        at cljs.repl$repl_STAR_$read_eval_print__6536.invoke(repl.cljc:957)
        at cljs.repl$repl_STAR_$fn__6542$fn__6551.invoke(repl.cljc:998)
        at cljs.repl$repl_STAR_$fn__6542.invoke(repl.cljc:997)
        at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1285)
        at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1274)
        at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:960)
        at cljs.repl$repl_STAR_.invoke(repl.cljc:839)
        at cljs.cli$repl_opt.invokeStatic(cli.clj:290)
        at cljs.cli$repl_opt.invoke(cli.clj:277)
        at cljs.cli$main.invokeStatic(cli.clj:612)
        at cljs.cli$main.doInvoke(cli.clj:601)
        at clojure.lang.RestFn.applyTo(RestFn.java:139)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$apply.invoke(core.clj:652)
        at cljs.main$_main.invokeStatic(main.clj:61)
        at cljs.main$_main.doInvoke(main.clj:52)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:702)
        at clojure.core$apply.invokeStatic(core.clj:657)
        at clojure.main$main_opt.invokeStatic(main.clj:317)
        at clojure.main$main_opt.invoke(main.clj:313)
        at clojure.main$main.invokeStatic(main.clj:424)
        at clojure.main$main.doInvoke(main.clj:387)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:702)
        at clojure.main.main(main.java:37)

{code:|title=Requiring the `:foreign-libs` library before the `:npm-deps` dependency works}
cljs.user=> (require '[google.api])
cljs.user=> (require '[left-pad])

2 Answers

0 votes
by

Comment made by: dnolen

It seems the issue here might not be one of order but of mishandling :file entries that use URLs.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2809 (reported by alex+import)
...