我正在从头开始编写一个 cljs 库(即没有 leiningen 模板)。使用lein figwheel
,Figwheel 成功地将我的 cljs 编译为 JS,但由于控制台中出现以下三个错误,因此无法完全连接到我的应用程序:
Uncaught TypeError: Cannot read property 'call' of undefined
at utils.cljs?rel=1627878774806:73
Uncaught TypeError: Cannot read property 'call' of undefined
at Function.cljs$core$IFn$_invoke$arity$3 (async.cljs?rel=1627878780415:57)
at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
at Function.cljs$core$IFn$_invoke$arity$1 (async.cljs?rel=1627878780415:54)
at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
at Function.cljs$core$IFn$_invoke$arity$0 (async.cljs?rel=1627878780415:53)
at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
at file_reloading.cljs?rel=1628044048652:338
Uncaught TypeError: Cannot read property 'call' of undefined
at Function.cljs$core$IFn$_invoke$arity$3 (async.cljs?rel=1627878780415:57)
at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
at Function.cljs$core$IFn$_invoke$arity$1 (async.cljs?rel=1627878780415:54)
at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
at Function.cljs$core$IFn$_invoke$arity$0 (async.cljs?rel=1627878780415:53)
at cljs$core$async$chan (async.cljs?rel=1627878780415:45)
at figwheel$client$file_reloader_plugin (client.cljs?rel=1628044052054:150)
at figwheel$client$add_plugins (client.cljs?rel=1628044052054:451)
at client.cljs?rel=1628044052054:473
这是我的 core.cljs:
(ns cljs-spotify-sdk.core)
(defn load-sdk []
(let [script-id "spotifySDK"]
(when-not (. js/document (getElementById script-id))
(let [script (. js/document (createElement "script"))]
(-> script (.-id) (set! script-id))
(-> script (.-type) (set! "text/javascript"))
(-> script (.-async) (set! true))
(-> script (.-src) (set! "//sdk.scdn.co/spotify-player.js"))
(let [first-js (-> js/document (.getElementsByTagName "script") (aget 0))
parent (.-parentNode first-js)]
(.insertBefore parent script first-js)))))
(.log js/console "SDK script inserted"))
如何解决这些错误?