question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Electron app name or productName ignored

See original GitHub issue

The package.json name and productName field doesn’t get read and the app name is always Electron even if the property is set, because the npm run dev script calls this: node .electron-vue/dev-runner.js which spawn electron on this line and probably (but I’m not sure since I’m still a noob) doesn’t set the root folder where package.json lives…

This is what I came up after some searches… is this correct?

I was reading something about this and I found this comment which explains something similar: https://github.com/electron/electron/issues/3391#issuecomment-155606143

Temporary i’m using this to set the correct userData path:

path.join(app.getPath('userData'), `../${pkg.name}`)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
jazzzzcommented, Feb 1, 2018

Same issue here, and I also think it’s a bug.

@p418, shouldn’t the workaround be this instead?

import {app} from 'electron'
import path from 'path'

const {build} = require('../../package.json')
const appData = app.getPath('appData')
app.setPath('userData', path.join(appData, build.productName))
1reaction
p418commented, Oct 12, 2017

Sorry, I realized that my previous code isn’t working (didn’t tried befeore submiting).

Try this one:

import {app} from 'electron'
import path from 'path'

const {build} = require('../../package.json')
const originalUserData = app.getPath('userData')
app.setPath('userData', path.join(originalUserData, build.productName))
Read more comments on GitHub >

github_iconTop Results From Across the Web

Electron app name doesn't change
it's supposed to use the productName in my package.json but it doesn't change. even if i made an installer, the name of the...
Read more >
Product Name Is Undefined After Building Electron App
The package.json name and productName field doesn't get read and the app name is always Electron even if the property is set, because...
Read more >
Common Configuration
productName String | “undefined” - As name, but allows you to specify a product name for your executable which contains spaces and other...
Read more >
node_modules/electron-packager · master · Accawi, Gina / ...
Electron desktop application allowing users to import images of curves to ... If appname is omitted, this will use the name specified by...
Read more >
Application Packaging
it is also possible to rebrand Electron by changing the product name and building it from source. To do this you need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found