UnhandledPromiseRejectionWarning: TypeError: settings.anyMethod is not a function
See original GitHub issueHello,
I’m currently updating Electron Settings from 3.2.0 to 4.0.1 and I got many issues. I was able to update my codebase based on the docs but when I’m trying to call any method, I get that UnhandledPromiseRejectionWarning telling me something is not a function where it should be.
Part of my code:
const settings = require('electron-settings');
// ...
function createWindow() {
// default
let version = "v0.1";
// ...
console.log(settings);
settings.configure({
dir: __dirname,
fileName: 'settings.json'
});
const exists = settings.hasSync('test');
console.log(exists);
if (settings.hasSync('version')) {
version = settings.getSync('version');
}
// ...
}
Full output (example):
$ npm start
> TestProject@0.0.1 start <<Path>>\src\main\electron
> electron .
{
default: {
file: [Function: file],
configure: [Function: configure],
reset: [Function: reset],
has: [Function: has],
hasSync: [Function: hasSync],
get: [Function: get],
getSync: [Function: getSync],
set: [Function: set],
setSync: [Function: setSync],
unset: [Function: unset],
unsetSync: [Function: unsetSync]
}
}
(node:4308) UnhandledPromiseRejectionWarning: TypeError: settings.configure is not a function
at createWindow (<<Path>>\src\main\electron\main.js:43:14)
(node:4308) UnhandledPromiseRejectionWarning: TypeError: settings.configure is not a function
at createWindow (<<Path>>\src\main\electron\main.js:43:14)
(node:4308) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4308) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4308) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:4308) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I think I made a tiny mistake but I’m not able to figure out… I hope that you can help me.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >JavaScript error: "is not a function" - Stack Overflow
Basically the object (all functions in js are also objects) does not exist ... it threw that "Uncaught TypeError: nom is not a...
Read more >JavaScript: Uncaught TypeError: n is not a function
This error occurs if you try to execute a function that is not initialized or is not initialized correctly. This means that the...
Read more >How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Should be now fixed in v4.0.2!
Beautiful, thanks for following up