Questions tagged [nodejs-server]
405 questions
39
votes
4 answers
The "chunk" argument must be of type string or an instance of Buffer
I'm running the following code and it fails with the below error.
AWS Code to list all objects inside a bucket.
const http = require('http');
const host = '127.0.0.1';
const port = 5000;
const path = require('path');
const url =…

anish anil
- 2,299
- 7
- 21
- 41
29
votes
2 answers
Using Vite for backend
We are using Vite for our frontend (inside SvelteKit) and it works nicely with creating SSR and frontend code.
I especially like the prebundling of 3rd party packages via esbuild.
Can someone tell me if it’s possible to use the Vite bundling…

user3612643
- 5,096
- 7
- 34
- 55
24
votes
2 answers
how to create a readable stream from a remote url in nodejs?
on nodejs documentation, the streams section says I can do fs.createReadStream(url || path).
But, when I actually do that It tells me Error: ENOENT: no such file or directory.
I just want to pipe the video from a readable to a writable stream, But…

Martin Wittick
- 433
- 1
- 4
- 14
17
votes
3 answers
What is the difference between the event loop in JavaScript and async non-blocking I/O in Node.js?
In this answer to the question -
What is non-blocking or asynchronous I/O in Node.js?
the description sounds no different from the event loop in vanilla js. Is there a difference between the two? If not, is the Event loop simply re-branded as…

Flame of udun
- 2,136
- 7
- 35
- 79
16
votes
4 answers
NodeJS environment variables undefined
I'm trying to create some envrioment variables but when I create the file and run the server the seem to be undefined. I'm using nodemon. I have restarted my server and no luck.
UPDATED
.env
MONGO_ATLAS_PW = "xxxx";
JWT_KEY =…

Patricio Vargas
- 5,236
- 11
- 49
- 100
13
votes
1 answer
AWS Lambda using Node Js gives "connect ETIMEDOUT" on http.request()
I have written lambda function that retrieve s3 Url whenever any new object created on s3 bucket.
after retrieve s3Url this lambda make request to my server over REST Call.
I observed cloud watcher.
It failed to send request to my Server
I don't…

Ameya Salagre
- 773
- 10
- 21
12
votes
2 answers
Why we pass "app" in http.createServer(app)
Why we pass "app" in http.createServer(app) as we can also pass
e.g :
var app = require('./app')
const http = require('http')
const port = 3500 || process.env.PORT
var server = http.createServer(app) //here we pass app
in other code we pass…

Amaan Imtiyaz
- 254
- 6
- 16
8
votes
1 answer
How are concurrent requests handled by Nodejs express http server?
I am building a Node.js application and wanted to understand how concurrent requests are handled.
I build a test server, where high CPU load is being simulated by waiting 10 seconds. To test the behavior, I open two browser tabs and refresh the page…

system_failure
- 85
- 1
- 1
- 4
7
votes
2 answers
How to rotate log files while running server with pm2?
We are using node module pm2 to run the server and capturing application logs.
But as the traffic is very huge, huge data is getting stored in single file which are around more than 100Gb.
Is there any possibility that we change the file every 1…

Jax
- 139
- 2
- 12
7
votes
4 answers
NPM is known not to run on Node.js v9.2.1
Why I use NPM to install something, it will have this problem as below
ERROR: npm is known not to run on Node.js v9.2.1
Node.js 9 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 9.0.0 to…

JackieWillen
- 673
- 1
- 12
- 23
5
votes
1 answer
Nest Js (Node Js Framework) - How to start server on Digital Ocean using pm2?
I have developed my project in the Nest JS framework. My main file in the src folder (src/main.ts). How can I start the server on my Digital Ocean server?

Alessia Williams
- 51
- 1
- 4
4
votes
1 answer
Do I *need* to use next(err) with Express.js?
Basically, the question is do I need to use next(err) when encountering any errors? The nodejs error documentation says it is fine to use a standard sort of if(err) else... for asynchronous callbacks and EventEmitters, as long as the error isnt…

LongStreak
- 71
- 5
4
votes
1 answer
NodeJS keep getting Failed to load resource: the server responded with a status of 404 (Not Found)
I'm trying to run a login project within nmp, I initialized the project, then the db side.
For now, when I try to run index.html and I get the mentioned above error. As well I'm not sure how to configure the "Run Configuration" of the project. Is…

Victoria
- 165
- 1
- 12
4
votes
2 answers
difference between Callback function and Promise and Async awit
I Understand Callback Function but I cant understand promise method and async and await.why to use this three function in node js.can give explain for example code.

smith hari
- 437
- 1
- 11
- 22
3
votes
0 answers
How to call a function directly through cmd to fetch and update records into database through Node js
I have a file CreateNewUserID.js, which has the code as below.
const Connection = require('./database/Connection')
const createNewUserID = async(connData, userId) => {
try{
var getConn = await Connection.get().getConn();
…

Sai sri
- 515
- 12
- 25