electron

安装ELectron失败解决方案

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 07:32:57
npm安装Electron解决方案 Electron使用npm安装时,因为是国外的镜像源,所以速度会非常慢。而使用cnpm如下命令进行安装时,又会出现安装失败的问题: npm install electron -g execute post install 1 scripts... [1/1] scripts.postinstall electron@6.0.3 run "node install.js", root: "C:\\Users\\94012\\AppData\\Roaming\\npm\\node_modules\\electron" Downloading tmp-1428-0-electron-v6.0.3-win32-x64.zip Error: GET https://cdn.npm.taobao.org/dist/electron/6.0.3/electron-v6.0.3-win32-x64.zip returned 404 C:\Users\94012\AppData\Roaming\npm\node_modules\electron\install.js:49 throw err ^ ...... Error: Failed to find Electron v6.0.3 for win32-x64 at https://cdn.npm.taobao

Using NodeJS plugins in Electron

落爺英雄遲暮 提交于 2019-12-05 07:08:52
问题 I am new to Electron (Atom-shell), and I am trying to load a NodeJS plugin into the application I am building, but I don't know how. The documentation is not clear on that. For instance, I am trying to use sqlite3 plugin in my app, I used npm install sqlite3 , and it was successfully installed. But the application throws and error when I try to call it var sqlite = require('sqlite3') . Are there any further steps I am not aware of ? Thanks. 回答1: For pure JS (i.e. not native) modules you need

require(“electron”).app is undefined. I npm installed fresh modules. Unsure what to do

本秂侑毒 提交于 2019-12-05 06:51:49
Yesterday, I was developing on Electron perfectly fine. Then I hop onto my computer to realize Electron isn't working at all now. I removed node_modules and did a fresh npm install package.json: ... "devDependencies": { "devtron": "^1.4.0", "electron": "^1.4.7" }, "dependencies": { "electron-debug": "^1.1.0" } ... This is the error I got. I followed the suggestions used of previous issues of this problem. Nothing is resolving it. Electron is not installed globally. Everything should be self contained in the directory. npm list Most of this code was taken from electron boilerplate Edit: main

Handling config files with webpack

拥有回忆 提交于 2019-12-05 05:42:07
I have an electron app that I'm building with webpack 2. I have a config file that I'm including like a normal webpack resource: config.js: export default { config1: 1, config2: 2 } main.js: import config from '../some/path/config'; console.log(config.config1); The config file code ends up in my bundle.js file as you would expect. The problem is that the point of config files is that you can change them after deployment. This set up requires me to re-webpackify everything if I want config file changes to take effect. Update 1: I thought file-loader might be the answer but the problem is that

TypeError: window.require is not a function

最后都变了- 提交于 2019-12-05 05:11:10
Im trying to build an electron app and want to use window.require. Unfortunately the compiler says "TypeError: window.require is not a function". Ironically require works only in main.js. Here the code Im trying to run: const electron = window.require('electron') const low = window.require('lowdb') const FileSync = window.require('lowdb/adapters/FileSync') I read in another post that somebody have had the same problem and it was fixed by adding this code into the .html file: <script type="text/javascript" src="../../../Gehaltseinstellungen_Hinzufügen.js"> window.nodeRequire = require; delete

Error messages and console logs in Electron?

℡╲_俬逩灬. 提交于 2019-12-05 05:05:10
How do you view error messages and console logs in Electron during development? Also, is it possible for the logs to be written directly into a file? Edit: Kind of like the errors and console logs displayed by Chrome's dev tools: Except in Electron rather than Chrome. On your BrowserWindow call the function openDevTools() this will open the same dev tools you find in Chrome. I wrote about this on my blog at http://www.mylifeforthecode.com/debugging-renderer-process-in-electron/ . Here is a simple main.js file that includes openDevTools: var app = require('app'); var BrowserWindow = require(

Is it possible to build Electron Apps on Mac Pro? Doesn't seem like it due to Bizarre GPU issue

对着背影说爱祢 提交于 2019-12-05 05:03:24
I tried to pull and tried to build two different bootstrap repos for Electron apps: https://github.com/pastahito/electron-react-webpack https://github.com/duskload/react-electron-webpack Followed the instructions only to be getting this error while starting the app using npm start AVDCreateGPUAccelerator: Error loading GPU renderer I am using a Mac Pro with macOS Mojave 10.14.5. From what I read: Mac Pros (2013 model)'s GPU architecture stumbles Electron/Chromium [for reasons beyond me]. I do have Electron apps like Slack and Atom running on that machine without problems, but for some reason,

Is it possible to drag a remote file out of Electron App onto the file system?

偶尔善良 提交于 2019-12-05 03:36:29
问题 I have been playing around with the file system drag and drop functionality of Electron apps and haven't had any issues getting everything to work with local files. I have not come across anything in the documentation, so I'd like to see if anyone knows if this is possible. I'd like to use the drag-out feature in Electron to drag a remote file outside of the app and onto the file system. Specific example: The program I am working on is a remote file management tool - similar to dropbox. I'd

How to protect source code in electron project

。_饼干妹妹 提交于 2019-12-05 03:28:49
I build my first electron app but now I wonder how to protect the source code to be view by other developers. The official doc says : To protect your app's resources and source code from the users, you can choose to package your app into an asar archive with little changes to your source code. So far the best I can think of is uglyfy the source-code and package it into a asar file, but the asar file is just an archive and can be easily be extracted. I don't see how having that make your code "protected from the user" Any ideas ? There is no official way to copy-protect your code at the moment,

Open local file in electron and render in wavesurfer.js

白昼怎懂夜的黑 提交于 2019-12-05 03:03:10
I'm working on an app built with electron, it should work with wavesurfer.js to display a waveform representing the audio file. However, I'm having trouble opening the file using the fs module and pushing the file content to wavesurfer via a Blob. The file loads and everything seems to work but when decoding wavesurfer says Error decoding audiobuffer . Two things I thought maybe could influence this: The fs.readFile function takes an encoding as second parameter The Blob constructor takes an options object as second parameter, whithin this you can define the mimetype via the type property