SimulatedGREG / electron-vue

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
https://simulatedgreg.gitbooks.io/electron-vue/content/
MIT License
15.48k stars 1.55k forks source link

Cannot use remote.app in renderer #773

Open moeen opened 5 years ago

moeen commented 5 years ago

I have a database connection in renderer dir and I have to get userData path using app.getPath.

Here is the code:

import { remote } from 'electron'
let databaseAddress = path.join(remote.app.getPath('userData'), 'db.db')

But it thorws an error which is: error

myazarc commented 5 years ago

you try direct electron. app not in remote. import electron from 'electron' let databaseAddress = path.join(electron.app.getPath('userData'), 'db.db')

moeen commented 5 years ago

The code now:

import { electron } from 'electron'
let databaseAddress = path.join(electron.app.getPath('userData'), 'db.db')

Error: screenshot from 2019-01-02 01-52-40

myazarc commented 5 years ago

only electron not {electron}:

import electron  from 'electron'
moeen commented 5 years ago

Sorry. This one doesn't throw any errors in terminal, but: screenshot from 2019-01-02 02-06-00