Fork me on GitHub
Kurt Harriger17:01:56

Hi I’m trying to run If I clone repo and use npm install with its current package-lock.json file using shadow-cljs ^2.8.110 it works. If I then run npm install shadow-cljs (updating to version ^2.16.12) run npm run dev and electron . it fails to start with

SHADOW import error /Users/kurt.harriger/projects/Logseq-Things-3-Plugin/shadow-electron-starter/.shadow-cljs/builds/main/dev/out/cljs-runtime/shadow.js.shim.module$ws.js
App threw an error during load
SyntaxError: Unexpected token ...
It appears that the ws module in previous version was 3.3.3 and is now updated to 7.5.6 and this new version seems to use es6 spread syntax that the old version did not. Oddly if I run npm run build and then electron . it still works but seems dev build doesn’t work. Any ideas? I guess I could fork ws and add a bunder step to ensure it exports es5 but I’m confused why upgrading shadow-cljs would pull in new ws version if shadow-cljs didn’t support it and why a release bulid works but dev build does not? maybe there is an option that needs added to the config?


did you also update electron? I mean the current version there seams to be 16.0.7? in the repo is 8 so probably ancient history by now?


maybe you also have a really old node version? this isn't an error from anything shadow-cljs is doing. the error is outside of the code it controls

Kurt Harriger17:01:36

Initially i tried using yarn and things blew up because it downloaded newer versions not using package.lock and tried to revert and use npm then upgrade 1 at a time to isolate I suppose maybe it only upgraded the minor version or soemthing. Let me give it another try


yeah lock files in demo repos are problematic if the demo isn't constantly maintained. can't assume that something that was written 4 years ago still works


FWIW you don't see the error in the release build since the release build probably doesn't use the ws package. that is only used for the hot-reload/repl websocket

Kurt Harriger17:01:59

oh that makes sense why it only shows up in dev build. But yeah issue still shows up after upgrading to electron 16

Kurt Harriger17:01:45

updated all the deps:

"dependencies": {
    "electron": "^16.0.7",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "shadow-cljs": "^2.16.12"
node version v16.13.0

Kurt Harriger17:01:00

electron -v v1.4.13

Kurt Harriger17:01:09

hmm npm WARN deprecated [email protected]: electron-prebuilt has been renamed to electron. For more details, see

Kurt Harriger17:01:35

there we go that was the issue


uhm where did that version come from? v1.4.13

Kurt Harriger17:01:03

followed the instructions to npm install -g electron-prebuilt but appears thats where the problem was


looks like you have a really really old global install?

Kurt Harriger17:01:54

I’ll send him a PR to update the example


npm install electron-prebuilt -g
npm install shadow-cljs -g


just skip these two completely and just use npx electron and npx shadow-cljs. that'll use the version installed in the project and not some global

Kurt Harriger17:01:35

yeah thats sounds best. thanks