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

0 votes
in ClojureScript by

I am developing a ClojureScript project using shadow-cljs and yarn. When I connect my REPL to the remote nREPL server everything works fine except when I try to load a namespace depending on js libraries that presumably use web worker threads. When this happens I get the following error:

------ REPL Error while processing ---------------------------------------------
(require '["firebase-admin" :as admin])
The required JS dependency "worker_threads" is not available, it was required by "node_modules/write-file-atomic/index.js".

Dependency Trace:

admin/fire/auth.cljs
node_modules/firebase-admin/lib/index.js
node_modules/firebase-admin/lib/default-namespace.js
node_modules/firebase-admin/lib/firebase-namespace.js
node_modules/firebase-admin/lib/firebase-app.js
node_modules/firebase-admin/lib/storage/storage.js
node_modules/@google-cloud/storage/build/src/index.js
node_modules/@google-cloud/storage/build/src/bucket.js
node_modules/@google-cloud/storage/build/src/file.js
node_modules/gcs-resumable-upload/build/src/index.js
node_modules/configstore/index.js
node_modules/write-file-atomic/index.js

Searched for npm packages in:

/Users/mbastian/workspace/myproject/node_modules

See: https://shadow-cljs.github.io/docs/UsersGuide.html#npm-install

I can easily reproduce the problem by trying to invoke the command (require '["firebase-admin" :as admin]).

firebase-admin has been installed. Note that the missing library is ''worker_threads" not firebase-admin.

worker_threads should be built in to node and available as of node 12. I am using v15.5.1.

Any ideas how to resolve this? Per Thomas Heller it may be a bug.

1 Answer

0 votes
by

worker_threads is a new-ish built-in node package which was not in the internal list shadow-cljs had for this. It was added in version 2.11.12.

...