简体   繁体   中英

Electron defaultConfig doesn't have an “app” parameter

I'm trying to fix an error that doesn't appear for other people trying to run this project. When running, I get this error:

The "path" argument must be of type string. Received type object

from the lines

const isoPath = electronSettings.get("settings.isoPath");
const fileDir = path.dirname(isoPath);

It turns out that isoPath is an uncaught typeerror promise object that basically says the following:

Cannot read property "app" of undefined

Going further into the code, I discovered this:

It's trying to get e.app , but e is undefined because return (_a = config.electron)?== null && _a:== void 0. _a; electron_1.default; return (_a = config.electron)?== null && _a:== void 0. _a; electron_1.default; evaluates to true, which means that either _a === void 0 or (_a = config.electron) === null and since _a is undefined, we can assume _a === void 0 , so for some reason config.electron has been defined but not given a value - config is defined by __assign({}, defaultConfig); .

defaultConfig :

var defaultConfig = {
    atomicSave: true,
    fileName: 'settings.json',
    numSpaces: 2,
    prettify: false,
};

There is no settings.json in my node_modules/ which relates to electron-settings at all, which I believe may be the source of my problems but I don't see anyone online discussing this issue.

For the curious, the problem file is at node_modules/electron-settings/dist/settings.js:92:70 , in the function getElectronApp .

Note that I'm on WSL1, though it shouldn't affect much in this situation.

No idea what fixed this, but recloning the repo I was working with and running everything from windows instead of WSL did the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM