hello, how can i use this remote in render file with electron
import {remote} from "electron";
when i import it ,it outputs
An error occurred when loading app.renderer.core.js
env.evalLoad @ renderer.js:1562
(anonymous) @ renderer.js:2005
renderer.js:1563 TypeError: exports.existsSync is not a function
at Object.shadow$provide.module$node_modules$electron$index (index.js:9)
at Object.shadow.js.jsRequire (js.js:66)
at Object.shadow.js.require (js.js:113)
at eval (js/cljs-runtime/app.renderer.core.js:3)
at eval (<anonymous>)
at Object.goog.globalEval (renderer.js:497)
at Object.env.evalLoad (renderer.js:1560)
at renderer.js:2005
env.evalLoad @ renderer.js:1563
(anonymous) @ renderer.js:2005
js/cljs-runtime/shadow.module.renderer.append.js:4 An error occurred when calling (app.renderer.core/start!)
eval @ js/cljs-runtime/shadow.module.renderer.append.js:4
goog.globalEval @ renderer.js:497
env.evalLoad @ renderer.js:1560
(anonymous) @ renderer.js:2006
renderer.js:1562 An error occurred when loading shadow.module.renderer.append.js
env.evalLoad @ renderer.js:1562
(anonymous) @ renderer.js:2006
renderer.js:1563 TypeError: app.renderer.core.start_BANG_ is not a function
at eval (js/cljs-runtime/shadow.module.renderer.append.js:4)
at eval (<anonymous>)
at Object.goog.globalEval (renderer.js:497)
at Object.env.evalLoad (renderer.js:1560)
at renderer.js:2006
Hi guys, I'm getting this error
The required JS dependency "entities/maps/entities.json" is not available, it was required by "node_modules/htmlparser2/lib/Tokenizer.js".
Dependency Trace:
tung_frontend/devcards/core.cljs
tung_frontend/devcards/text_chat.cljs
node_modules/stream-chat-react/dist/index.js
node_modules/react-markdown/with-html.js
node_modules/react-markdown/lib/with-html.js
node_modules/react-markdown/lib/plugins/html-parser.js
node_modules/html-to-react/index.js
node_modules/html-to-react/lib/parser.js
node_modules/htmlparser2/lib/index.js
node_modules/htmlparser2/lib/Parser.js
node_modules/htmlparser2/lib/Tokenizer.js
Searched for npm packages in:
/home/anonimito/work/pegleg/clojure/eviota-frontend/node_modules
See: <https://shadow-cljs.github.io/docs/UsersGuide.html#npm-install>
I found this old shadow-cljs thread that contains this exact error message
https://clojurians-log.clojureverse.org/shadow-cljs/2020-08-20/1598004360.046400 but it doesn't seem to work for me.
Relevant config:
:devcards {:asset-path "js/devcards"
:modules {:main {:init-fn tung-frontend.devcards.core/main}}
:compiler-options {:devcards true}
:output-dir "resources/public/js/devcards"
;; :devtools {:httop-root "resources/public" :http-port 8281}
:target :browser
:build-options {:ns-aliases {devcards-marked
tung-frontend.devcards.cljsjs.marked
devcards-syntax-highlighter
tung-frontend.devcards.cljsjs.highlight}}
;; See <https://clojurians-log.clojureverse.org/shadow-cljs/2020-08-20>
:js-options {:resolve {"entities/maps/entities.json"
{:target :npm
:require "entities/lib/maps/entities.json"}}}}
I'm using thheller/shadow-cljs "2.11.4"
Weird, installing htmlparser2
manually seems to solve it. π
very likely a dependency conflict
not enough code to comment. you are calling existsSync
on something but I can't guess the code doing that.
Right, I see 2 versions of it (via yarn why
)
=> Found "htmlparser2@3.10.1"
info Has been hoisted to "htmlparser2"
info Reasons this module exists
- Hoisted from "stylelint#postcss-html#htmlparser2"
- Hoisted from "stream-chat-react#react-images#html-react-parser#html-dom-parser#htmlparser2"
info Disk size without dependencies: "420KB"
info Disk size with unique dependencies: "1.09MB"
info Disk size with transitive dependencies: "1.29MB"
info Number of shared dependencies: 12
=> Found "html-to-react#htmlparser2@5.0.1"
info This module exists because "stream-chat-react#react-markdown#html-to-react" depends on it.
info Disk size without dependencies: "164KB"
info Disk size with unique dependencies: "584KB"
info Disk size with transitive dependencies: "608KB"
info Number of shared dependencies: 5
const fs = require('fs');
const path = require('path');
const pathFile = path.join(__dirname, 'path.txt');
function getElectronPath () {
if (fs.existsSync(pathFile)) {
const executablePath = fs.readFileSync(pathFile, 'utf-8');
if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath);
}
return path.join(__dirname, 'dist', executablePath);
} else {
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');
}
}
module.exports = getElectronPath();
i found it in node_modules/electron/index.jsusing "electron": "^12.0.6",
I'm guessing you are not supposed to use that in the renderer?
I don't use electron so I really cannot help much
yes, i just want to use dialog in electron.remote
anyone had any issues with watching changes in Linux on Windows environment?
I have a client, who has launched shadow-cljs watch app
, then he changes a view file, but shadow doesnβt recompile.
Perhaps may be some WSL issue.
If shadow-cljs build is re-launched β then it updates the view.
----
UPD: My client found this https://stackoverflow.com/questions/66055215/emacs-cider-with-shadow-cljs-browser-settings-on-windows-wsl2-hot-code-reload/66061927#66061927, so suspicion moves strongly towards WSL conf.
----
UPD2: Fixed with SO instructions
yes, common wsl2 problem
I've done all my wsl2 development from within the linux FS and had no problems with any watchers.
same here, vim and vscode, latter has own support for editing wsl projects, works very well
the problem happens when you edit the files from windows via the mounted fs. if you edit files from within the wsl distro that is fine