Uncaught Error: Cannot find module ‘jquery’

tl;dr In contrast to a normal nodejs app, where you have access to global modules (e.g. located in /usr/bin/node), electron doesn’t automatically set the NODE_PATH environment variables. You have to set it manually to all the paths containing your desired modules. Update: The answer to the question why require(“ipc”) is working and require(“jquery”) not? is … Read more

How to use React Router with Electron?

Had to Replace BrowserRouter with HashRouter. import { HashRouter, Route } from “react-router-dom”; And then in my index.js or the entry file of the Electron app I had something like this: <HashRouter> <div> <Route path=”https://stackoverflow.com/” exact component={ Home } /> <Route path=”/firstPage” component={ FirstPage } /> <Route path=”/secondPage” component={ SecondPage } /> </div> </HashRouter> And … Read more

Saving files locally with electron

If you are targeting multiple platforms, I answered a similar question here. Basically app.getPath(name), app.setPath(name, path), and app.getAppPath() are very useful in saving files to the the right place regardless of the OS. You may also want to check out these Nodejs packages which help simplify saving files directly to the host machine… fs-jetpack graceful-fs … Read more

How to persist data in an Electron app? [closed]

NeDB is the only suggested or featured tool as an embedded persistent database for Electron by Electron, currently. – http://electron.atom.io/community/ It’s also could be useful to store user settings if settings are complex. Why NeDB could be a better solution on this case? Embedded persistent or in memory database for Node.js, nw.js, Electron and browsers, … Read more

How can I force external links from browser-window to open in a default browser from Electron?

I came up with this, after checking the solution from the previous answer. mainWindow.webContents.on(‘new-window’, function(e, url) { e.preventDefault(); require(‘electron’).shell.openExternal(url); }); According to the electron spec, new-window is fired when external links are clicked. NOTE: Requires that you use target=”_blank” on your anchor tags.

Electron.remote is undefined

Update 2020, since this answer still appears at the top. For the original answer to work in current versions of Electron, you need to set enableRemoteModule when creating the window in your main process. const myWindow = new BrowserWindow({ webPreferences: { enableRemoteModule: true } }); Original answer: remote is needed only to require other modules … Read more

How to read audio data from a ‘MediaStream’ object in a C++ addon

The MediaStream header is part of Blink’s renderer modules, and it’s not obvious to me how you could retrieve this from nan plugin. So, instead let’s look at what you do have, namely a v8::Object. I believe that v8::Object exposes all the functionality you need, it has: GetPropertyNames() Get(context, index) Set(context, key, value) Has(context, key) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)