react development server keeps crashing - node.js

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.

Related

Front React server crash : node:internal/buffer:959

I am building an ecommerce website using Strapi (back) and React (front).
I don't why i have the current error:
node:internal/buffer:959
super(bufferOrLength, byteOffset, length);
^
RangeError: Array buffer allocation failed
at new ArrayBuffer ()
at new Uint8Array ()
at new FastBuffer (node:internal/buffer:959:5)
at createUnsafeBuffer (node:internal/buffer:1062:12)
at Function.allocUnsafeSlow (node:buffer:384:10)
at read (C:\Users\lenoa\Documents\ELN WEB\Projets en cours\freedom-x\frontend\node_modules\webpack\lib\serialization\FileMiddleware.js:597:32)
at C:\Users\lenoa\Documents\ELN WEB\Projets en cours\freedom-x\frontend\node_modules\webpack\lib\serialization\FileMiddleware.js:657:7
at C:\Users\lenoa\Documents\ELN WEB\Projets en cours\freedom-x\frontend\node_modules\graceful-fs\graceful-fs.js:362:16
at FSReqCallback.oncomplete (node:fs:188:23)
It happens when i am navigate on the website, i don't know why.
Thank you for your help !
Finally i figured it out.
If you have the same issue : just uninstall Nodejs from your computer, then reinstall it.
It work for me.
Have a good day !
Try to put after the response:
await setTimeout(0)
If this doesn't work, check out which Node version do you have. Maybe you need to install the node 64 and rebuild all de node modules.

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

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
}

Meteor 0.7 error

I need help.
After upgrading meteor to 0.7 version, application can not start with strange error (but, before update and if i create a new app - it worked well):
ant#ant-VirtualBox:~/testtracker$ mrt
Stand back while Meteorite does its thing
Done installing smart packages
Ok, everything's ready. Here comes Meteor!
[[[[[ ~/testtracker ]]]]]
/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/fibers/future.js:173
throw(ex);
^
TypeError: Cannot call method 'split' of undefined
at parseStack (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:257:26)
at Object.exception (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:399:17)
at /home/ant/.meteor/tools/ec9f953f89/tools/packages.js:448:22
at Array.forEach (native)
at Function._.each._.forEach (/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/underscore/underscore.js:79:11)
at _.extend.build (/home/ant/.meteor/tools/ec9f953f89/tools/packages.js:235:7)
at /home/ant/.meteor/tools/ec9f953f89/tools/packages.js:1041:13
at Array.forEach (native)
at Function._.each._.forEach (/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/underscore/underscore.js:79:11)
at _.extend.build (/home/ant/.meteor/tools/ec9f953f89/tools/packages.js:1040:7)
at _.extend.getForApp (/home/ant/.meteor/tools/ec9f953f89/tools/library.js:285:9)
at /home/ant/.meteor/tools/ec9f953f89/tools/bundler.js:1646:25
at Object.capture (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:175:5)
at Object.exports.bundle (/home/ant/.meteor/tools/ec9f953f89/tools/bundler.js:1580:31)
at /home/ant/.meteor/tools/ec9f953f89/tools/run.js:532:32
at /home/ant/.meteor/tools/ec9f953f89/tools/fiber-helpers.js:24:12
Please, give me advice, what i can do with this.
I think you need to update mrt packages as well.
mrt update
Do you use the mongodb instance from meteor or do you use an external mongodb instance (used by MONGO_URL env) ?
I got the same problem because it seems that mongolab doesn't accept the new oplog system from meteor.
Finally i now use the internal mongodb instance because i didn't find another solution from mongolab.

Can't run redis-node-client test code

I downloaded node.js (.3), redis (2.0.4), and redis-node-client (git clone). When I start the redis server in one window, then go to the node-client folder and run
node test/test.js
I get
........................................
node.js:66
throw e; // process.nextTick error, or 'error' event on first tick
^
Maximum call stack size exceeded
I'm using the default configs at the moment. Haven't changed anything. Any ideas?
Hm, turns out to be version incompatibilities. Going to v0.2.5 fixes it.
Edit: nevermind, no it doesn't. Comes up with new error:
AssertionError: "testZINTER" "ERR unknown command 'zinter'"
at /Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/test/test.js:121:25
at Client.onReply_ (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:400:34)
at /Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:143:30
at ReplyParser.feed (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:160:55)
at Stream.<anonymous> (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:337:28)
at Stream.emit (events:27:15)
at IOWatcher.callback (net:489:16)
at node.js:773:9
Sadly, redis-node-client is no longer maintained. That's why I've written node_redis, which you can get with:
npm install redis
There are a lot of people using it now, and this has helped us work out a lot of bugs. Let me know if you have any issues with it.

Resources