Error when trying to execute "firebase deploy" in React App - node.js

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

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.

Promise.allSettled is not a function with node 14.0.0

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 ?

npm start (or yarn start) error with babel when creating react applications

I am trying this article working on a react calculator
I set my package.json with "start": "babel-node ./server/server.js" in the scripts. When I run npm start, errors shows up. yarn start gives more details error message shown there.
max#DESKTOP-4J1U771 MINGW64 ~/Documents/react-calculator (master) $
yarn start yarn run v1.7.0 warning package.json: No license field $
babel-node ./server/server.js
C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\logger.js:41
throw new Constructor(this._buildMessage(msg));
^
ReferenceError: [BABEL]
C:\Users\max\Documents\react-calculator\server\server.js: Unknown
option: base.0. Check out h ttp://babeljs.io/docs/usage/options/ for
more information about options.
A common cause of this error is the presence of a configuration
options object without the corresponding preset name. Example:
Invalid: { presets: [{option: value}] } Valid: { presets:
[['presetName', {option: value}]] }
For more detailed information on preset configuration, please see
https://babeljs.io/docs/en/plugins#pluginpresets-op tions.
at Logger.error (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\logger.j
s:41:11)
at OptionManager.mergeOptions (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation
\file\options\option-manager.js:226:20)
at OptionManager.init (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\op
tions\option-manager.js:368:12)
at File.initOptions (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\inde
x.js:212:65)
at new File (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\index.js:135
:24)
at Pipeline.transform (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\pipelin
e.js:46:16)
at Object.transformFileSync (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\api\node.js:152:
10)
at compile (C:\Users\max\Documents\react-calculator\node_modules\babel-register\lib\node.js:118:20)
at loader (C:\Users\max\Documents\react-calculator\node_modules\babel-register\lib\node.js:144:14)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\max\Documents\react-calculator\node_modules\
babel-register\lib\node.js:154:7) error Command failed with exit code
1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this > command.
Does anyone see what's going on here and how to solve it?
Use create-react-app. It is way simpler than configuring babel and creating React projects the old way. To use it, go to the directory you want your project to be in, and type in your terminal: create-react-app [project-name]. This will do all the configuring for you and make it easier for you. The installation and configuration of React mentioned in the article is outdated, but you can still follow everything else in that tutorial. Good luck!

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

Sails.js/Condolidate/Twig Error

I'm getting the following error when I request a view in Sails that is using Twig.js:
error: Sending 500 ("Server Error") response:
TypeError: engine is not a function
at /usr/lib/node_modules/sails/node_modules/consolidate/lib/consolidate.js:479:61
at /usr/lib/node_modules/sails/node_modules/consolidate/lib/consolidate.js:143:5
at Promise._execute (/usr/lib/node_modules/sails/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/usr/lib/node_modules/sails/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/usr/lib/node_modules/sails/node_modules/bluebird/js/release/promise.js:79:10)
at promisify (/usr/lib/node_modules/sails/node_modules/consolidate/lib/consolidate.js:136:10)
at Function.exports.twig.render (/usr/lib/node_modules/sails/node_modules/consolidate/lib/consolidate.js:473:10)
at /usr/lib/node_modules/sails/node_modules/consolidate/lib/consolidate.js:164:27
at /usr/lib/node_modules/sails/node_modules/consolidate/lib/consolidate.js:98:5
at tryToString (fs.js:456:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
I've tried to fix this many different ways, but I'm still getting the error. I understand Sails should allow me to use anything supported by Consolidate.js, but it just isn't working.
I have:
cleared the NPM cache
installed Twig.js (v1.10.4) using NPM, and it's in my package.json
Removed and reinstalled twig
set the engine to 'twig' in config/views.js
This is a fresh Sails project without any other customizations or additions.
I'm a little new to node and sails, any help is appreciated!
Looks like there's a bug with the Sails v0.12.x handling of Twig. The easiest workaround is to install Consolidate yourself as a dependency of your project:
npm install --save consolidate
and then in your config/views.js do:
engine: {
ext: 'twig',
fn: require('consolidate').twig
}

Resources