"Unhandled promise rejection" error when installing ionic 2 plugins - node.js

I get the following error during installation of the Cordova OneSignal plugin:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object]
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 couldn't find any solutions on Google.

Related

How to fix "Can't find training file" error?

I get this error:
Error: Can't find training file, please try to specify it with the --source option
I thought it was a file path issue, so I added source and still got an error:
(node:36619) UnhandledPromiseRejectionWarning: Can't parse json file "/Users/Cos-Ibe/Futo_Chatbot/data/data.json"
SyntaxError: Unexpected token in JSON at position 0
(Use `node --trace-warnings ...` to show where the warning was created)
(node:36619) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:36619) [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.

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'findIndex' of undefined..... IN MY NODEJS Project

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'findIndex' of undefined
at User.addToCart (D:\Pradip_All\Nodejs- tutorials video (MONGODB)\models\user.js:20:46)
at D:\Pradip_All\Nodejs- tutorials video (MONGODB)\controllers\shop.js:70:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11212) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict`
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11212) [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.
ERROR DESCRIPTION
You should add the ? optional chaining operator that check if the value exists in the object.
const cartProductIndex = this.cart?.items?.findIndex((cp) => {
return cp.productId.toString() === product._id.toString()
})

I'm getting an error using aeproject test command with initialized project

I installed aeproject by doing:
$ npm install -g aeproject
Initiallized my project with
$ aeproject init
And when I want to test it with
$ aeproject test
I get the following error:
(node:68448) UnhandledPromiseRejectionWarning:
/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/aeproject-deployer.js:1
Error: Cannot find module 'aeproject-utils' Require stack:
/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/aeproject-deployer.js
/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/index.js
/Users/meli/MyStuff/MyAE/ae_tutorial1/test/exampleTest.js
/usr/local/lib/node_modules/aeproject/node_modules/mocha/lib/mocha.js
/usr/local/lib/node_modules/aeproject/node_modules/mocha/index.js
/usr/local/lib/node_modules/aeproject/aeproject-test/aeproject-test.js
/usr/local/lib/node_modules/aeproject/aeproject-test/test.js
/usr/local/lib/node_modules/aeproject/commands.js
/usr/local/lib/node_modules/aeproject/aeproject-cli.js
at Object. (/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/aeproject-deployer.js:21:43)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) (Use node --trace-warnings ... to show where the warning was created) (node:68448)
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(). To terminate the node process on unhandled promise
rejection, use the CLI flag --unhandled-rejections=strict (see
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
(rejection id: 2) (node:68448) [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.
You can fix this issue by doing
$ npm install aeproject-utils prompts aeproject-logger

(node:13606) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object] - Ionic Framework

I'm working with the Ionic Framework in its 3rd version, and when I run ionic cordova build --release android, I get this error :
(node:13791) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object]
(node:13791) [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.
Other threads about this didn't lead me anywhere. Please help
my first attempt would be to check my code for an unhandled promise rejection.
How can i dectect a unhandled promise rejection?
assuming we have a code like this:
asyncAction.then(success => {
// do stuff with the result of success
})
so if the asyncActions fails, there is an unhandled promise rejection because we never catch the rejection of the promise. To catch the rejection we need to do this:
asyncAction.then(success => {
// do stuff with the result of success
}, rejection => {
// handle action failed
})
I solved my problem downgrading cordova version to 7.1.0

node js warning about promise rejections

I today run my node js app that i development for months and before it was all excellent..now in console i see this warning errors:
(node:19318) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 1): ReferenceError: done is not defined
(node:19318) 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:19318) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 2): ReferenceError: done is not defined
(node:19318) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 3): ReferenceError: done is not defined
(node:19318) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 4): ReferenceError: done is not defined
(node:19318) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 5): ReferenceError: done is not defined
(node:19318) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 6): ReferenceError: done is not defined
Where can I find what module or function is causing this warning? Because yesterday works all excellent and no code modification is done...where I can search for a problem to fix it? I try to search for Promise in index.js but there is not found...so I think that some npm module is using Promise and how to detect what is it? Does node js have some log text file output that writes in text file description of error what causing it?

Resources