Promise.allSettled is not a function with node 14.0.0 - node.js

I'm trying to start an app which includes a simple Promise.allSettled(), but it crashes at start with the following error :
UnhandledPromiseRejectionWarning: TypeError: Promise.allSettled is not a function
I looked it up, and most answers are related to allSettled not being available before node 12.9, but I'm running v14.0.0
How can I fix this ?

Related

react development server keeps crashing

am trying to build an ecommerce website to practice more on react. I have bunch of frameworks i installed for my react project, but recently, running react in localhost keeps crashing with this error info-
node:internal/buffer:959
super(bufferOrLength, byteOffset, length);
^
below is a description of the error
node:internal/buffer:959
super(bufferOrLength, byteOffset, length);
^
RangeError: Array buffer allocation failed
at new ArrayBuffer (<anonymous>)
at new Uint8Array (<anonymous>)
at new FastBuffer (node:internal/buffer:959:5)
at createUnsafeBuffer (node:internal/buffer:1062:12)
at Function.allocUnsafeSlow (node:buffer:385:10)
at new Uint8Array (<anonymous>)
at new FastBuffer (node:internal/buffer:959:5)
at createUnsafeBuffer (node:internal/buffer:1062:12)
at Function.allocUnsafeSlow (node:buffer:385:10)
at read (C:\Users\HP-PC\Desktop\react\ecom\node_modules\webpack\lib\seri
alization\FileMiddleware.js:597:32)
at C:\Users\HP-PC\Desktop\react\ecom\node_modules\webpack\lib\serializat
ion\FileMiddleware.js:657:7
at C:\Users\HP-PC\Desktop\react\ecom\node_modules\graceful-fs\graceful-f
s.js:362:16
at FSReqCallback.oncomplete (node:fs:188:23)
I have uninstalled and re-installed my node js(based on a proposed solution i saw online), but am still getting the error.
try to npm update to update modules , if failed try to remove webpack and graceful-fs
incase someone runs into this error in the future, just update your node and manage it with nvm. that helped me. Was running node 32bit instead of 62bits.

Node server.js Mern stack tutorial question

I am following this tutorial step by step on Windows 10, and when I get to the section where I run Node server.js I get the error
C:\xampp\htdocs\test1\mern\server\node_modules\mongodb-connection-string-url\lib\index.js:9
return (connectionString.startsWith('mongodb://') ||
TypeError: Cannot read properties of undefined (reading 'startsWith')
at connectionStringHasValidScheme (C:\xampp\htdocs\test1\mern\server\node_modules\mongodb-connection-string-url\lib\index.js:9:30)
and there are more at items after this. I do not get the expected
Server is running on port: 5000
Successfully connected to MongoDB.
It looks like this exact question was asked here but wasn't answered.
When I run node --version I get v18.12.1 and java --version produces java 19.0.1 2022-10-18.
When I inspect the index.js file with the function, it defines the function as
function connectionStringHasValidScheme(connectionString) {
return (connectionString.startsWith('mongodb://') ||
connectionString.startsWith('mongodb+srv://'));
}
I am new to MERN stack, hence the tutorial. Any help would be appreciated :).

Error when trying to execute "firebase deploy" in React App

When trying to deploy my React application, after having done "npm run build" and after configure the hosting in "firebase.json" file, the whole firebase process runs correctly until I get the message "Error: An unexpected error has occurred." checking the file "firebase-debug.log" I find this problem:
TypeError: Reduce of empty array with no initial value
at Array.reduce (<anonymous>)
at release (C:\Users\Jhonny\AppData\Roaming\nvm\v16.0.0\node_modules\firebase-tools\lib\deploy\functions\release.js:47:10)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
[error]
[error] Error: An unexpected error has occurred.
This problem is solved by directly modifying the Node file but then another similar message appears, and so on, also I don't think it is the correct solution.
Node version: 14.17 LTS
Thanks in advance
One possibility is that you forget to export the function like:
export const func = functions. // ...
Simply, upgrade node by running the following command in your terminal:
npm install node

Cant deploy Meteor app in Zeit, Object.getOwnPropertyDescriptors is not a function

I try to upload my METEOR project to zeit and I get
502 An error occured with your deployment.
then I run now logs and get the following error
/usr/src/app/bundle/programs/server/node_modules/fibers/future.js:280
throw(ex);
TypeError: Object.getOwnPropertyDescriptors is not a function
at insert (packages/mongo/collection.js:435:12)
at updateVersions (packages/autoupdate.js:125:20)
at packages/autoupdate.js:189:3
at Function.time (/usr/src/app/bundle/programs/server/profile.js:309:28)
at /usr/src/app/bundle/programs/server/boot.js:423:13
at /usr/src/app/bundle/programs/server/boot.js:464:5
at Function.run (/usr/src/app/bundle/programs/server/profile.js:510:12)
at /usr/src/app/bundle/programs/server/boot.js:462:11
What could be wrong?
node version v8.9.3
npm version 5.5.1
Error traced to commit:
mongo 1.3.1 changes
See issue created:
Meteor Issue 9470

mangopay intergation in node js. Could not create user

I am integrating mangopay in node js and I am using npm for mangopay2-nodejs-sdk.but when I use api.Users.create function for creating user ,it gives me error
Debug: internal, implementation, error
TypeError: Uncaught error: Cannot read property 'userClass' of undefined
at Service.extend.create (/home/hashir/artpaie/artapieapp/artapieBackend/node_modules/mangopay2-nodejs-sdk/lib/services/Users.js:38:41)
The error handler in _getUserApiAndClass method seems not to be working, my problem was that I didn't have specified the PersonType.
It is uppercase
Natural: 'NATURAL'
Legal: 'LEGAL'

Resources