Questions tagged [node.js]

Node.js is an event-based, non-blocking, asynchronous I/O runtime that uses Google's V8 JavaScript engine and libuv library. It is used for developing applications that make heavy use of the ability to run JavaScript both on the client, as well as on server side and therefore benefit from the re-usability of code and the lack of context switching.

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

Hello. I am a beginner and I am having trouble. I am not able to run the code and keep getting Error: Cannot find module

I am not able to run the code and keep getting Error: Cannot find module (the code) const hello = 'hw'; console.log(hello); (The error Message) Rs-MBP:1-node-farm rs1596$ node index.js internal/...
0
votes
0answers
14 views

Handle POSTing a file to a server (and giving it a unique URL) in Node.js?

I'm using the following code to upload a file to a node.js server: <form enctype="multipart/form-data" action="/upload" method="post"> <input id="image-file" type="file" /> <...
-1
votes
0answers
15 views

Why is my prompt not showing up in terminal js

My prompt code The result(used to have a question but no longer) I have found no posts relating to this
0
votes
0answers
8 views

discord.js channelCreate() event is triggered when joining a server

When a bot joins a server it is triggering 2 events 1st is guildCreate event and the second is channelCreate event here is my events loader const ascii = require("ascii-table"); let table = new ...
0
votes
0answers
4 views

Cannot Find Module 'ytdl-core' (Discord bot)

After adding 'ytdl-core' to node_module in files. I tried to use it for a discord bot by requiring (const ytd1 = require('ytd1-core');) but it errors and does this: module.js:538 throw err; ^ ...
1
vote
1answer
19 views

Saving file to AWS S3

I've been following some examples here and on Google of how to write a Nodejs Lambda function to fetch an (audio) file from a URL and save it to S3. I've arrived at this so far: var AWS = require('...
0
votes
0answers
9 views

Sequelize Model Relationships

I have 2 models and what I am trying to do is when a match is created, it will automatically create a match report. here is the code: Match.js const Sequelize = require('sequelize'); const db = ...
0
votes
0answers
12 views

facebook strategy of passportjs is not passing data to next funtion

I am having a problem with passport Facebook strategy. This is my route: app.post('/auth/facebook', passport.authorize('facebook-token', {session: false}), socialAuths.fbAuth ); This is ...
0
votes
0answers
13 views

How to resize image in a stream using Node JS? using ffmpeg or sharp

I have stored my image files to mongo database using Mongo grid fs and node js . Now I wanted to resize the image on a stream I wanted to achieved the following sizes 320x240px 900x600px 150x100px ...
0
votes
0answers
9 views

Install expo cli errors at the end of install

So I'm following this tutorial to try and learn React Native: https://www.youtube.com/watch?v=qSRrxpdMpVc And in the tutorial he shows to install expo cli using the line 'npm install expo-cli --...
0
votes
0answers
7 views

ExpressJS pass data to public js file

I am new in ExpressJS, I know how to pass data from backend to the an ejs page, but I wanted to know how to pass data to a js file in the public folder? So to pass data to a js file ( which js file ...
0
votes
0answers
9 views

How to call API, looping over axios.get() adding ?offset=<param> and exit loop?

I have an API call to http GET data, 100 records at a time. It has a GET URL param: ?offset= that can be set to fetch all results. Initially I believe offset would be 0, would have to test, but ...
1
vote
0answers
5 views

Heroku server crashes with “JavaScript heap out of memory” when deploying 'react-admin' app

I am currently developing an admin panel using 'react-admin' which works well on my local, but as soon as I upload the app to Heroku, the build fails with the following error: "FATAL ERROR: ...
1
vote
0answers
7 views

Reading a ZIP archive from S3, and writing uncompressed version to new bucket

I have an app where user can upload a ZIP archive of resources. My app handles the upload and saves this to S3. At some point I want to run a transformation that will read this S3 bucket unzip it, and ...
0
votes
0answers
5 views

Error deploying express project on heroku|

i'm deploying my first app on heroku, i pushed the code on GitHub, add Heroku keys(because ), created the heroku app on terminal and finally git push heroku master. The app is very basic, but it ...
-1
votes
0answers
14 views

What is the commonly used SortedMap implementation in NodeJS? [closed]

In Java, you have SortedMap when you want a map structure which sorts all its entries by some certain key. Refer: https://docs.oracle.com/javase/8/docs/api/java/util/SortedMap.html I want to achieve ...
0
votes
0answers
17 views

How do I make an http request with fetch in node? node-fetch

I am trying to make a request in node. Here is my code: fetch("http://www.test.com", options).catch(err => { console.error(err); return err; }); Here is the error that I get. ...
0
votes
0answers
5 views

http request module look taking a long time

I am calling an API to refresh some in game prices as fast as possible, using requet node module. For a while, my code worked but it seems like it is having trouble now. When my loop is executed, ...
0
votes
0answers
7 views

Jest Unit Test for Nodejs/NestJS ExceptionFilter Catch Method

This is my BadRequestExceptionFilter written in Typescript for Nodejs/Nestjs @Catch(BadRequestException) export class BadRequestExceptionFilter implements ExceptionFilter { constructor(private ...
0
votes
0answers
10 views

Can you exported JS bundle include “process.env.NODE_ENV !== production”

I am trying to build a library that has some helper functions. There is this one helper function that utilizes Node's process.env.NODE_ENV variable to determine the return value. Lets say that this ...
0
votes
0answers
7 views

Send Information from BrisghtScript to NodeJS using a BrightSign device

I have enable NodeJS to my device(BrightSign) and now I can use Javascript objects for Brightscript, for example BSDeviceInfo for getting information of my device, so far everything is ok. Now ...
-3
votes
2answers
38 views

How promises work in Typescript - I have error in mysql

I'm working in an Angular 8.3 app with Node 10.17 and Mysql. When I try to send information in JSON to the Backend I got an error in promises and I don't know what to do. I've already investigated ...
0
votes
0answers
9 views

How to click on certain part of div in puppeteer?

I'm trying to access a page with a div that produces a different output depending on the part that is clicked. Picture a div 1000 pixels wide, and depending on which pixel you click, you get the pixel ...
0
votes
0answers
6 views

How to Scroll Up/Down in Andriod Appium using wd driver using Javascript-nodejs?

I am trying to automate an Android APP where I need to scroll down/up the screen using the wd driver using Javascript(NodeJS Automated Testing with WD.js) I tried using the below locators and it didn'...
0
votes
0answers
8 views

How can I run multiple vs code node applications with a single powershell command?

I have one node app with multiple microservices node applications, I want to run all of those node applications with a single powershell command?
0
votes
1answer
9 views

why header event is not getting triggered in nodejs

I have this code in my one of the application. const readStream= fs.createReadStream('xlsx file path here'); readStream.on('header', (header) => { console.log('header ...
0
votes
0answers
22 views

I am getting : “Uncaught SyntaxError: Cannot use import statement outside a module”

Hi everyone I trying to build a small app, but unfortunatly at the end I getting this error below. I have look others topics here but it is not quit the same as mine. What can I do to solve this issue?...
0
votes
1answer
16 views

How can I generate multiple pdfs in a loop with html-pdf?

I'm currently trying to generate approximately 5000 pdf files that have qr codes as part of the content of each pdf. I'm using the qrcode(https://www.npmjs.com/package/qrcode) package to generate ...
0
votes
0answers
21 views

No TypeScript errors when accessing undefined methods of a require-d class

I'm starting with TypeScript on a Node.JS stack, and I've noticed that when using require to import classes, TypeScript doesn't have a compilation error when methods (or properties) aren't defined. ...
0
votes
1answer
16 views

Discord.js - Logging channel deletes gives error “UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined”

I'm trying make my discord.js bot log when people create, and delete channels using the audit logs. I have the create logging down, but the delete part is giving me an error: "...
0
votes
0answers
9 views

Posting method in Nodejs app to SharePoint

I am trying to run a post method in my node js app and it connects with SharePoint. When I do it in Postman it works and also my GET method is working but I seem to be doing something wrong with my 2 ...
0
votes
0answers
24 views

How to debug this NodeJS error: TypeError: Cannot read property '_writableState' of undefined

I am trying to write a NodeJS application and running into an error. I can't tell why it is happening. It seems completely unrelated to the part of the code where it is happening. None of the files ...
0
votes
0answers
8 views

Webpack bundles still looking for node_modules when running node on webpack bundle inside Docker

I don't get this error locally, but when I run my bundle node bundle.js inside my docker container, I'm getting Error: Cannot find module 'babel-polyfill'. I use babel-polyfill explicitly within my ...
0
votes
0answers
9 views

Using NodeJS Express server with PM 2 in cluster mode

So, I will try and explain this to the best of my ability: I wrote a TCP server that accepts data from a wearable (type of gps bracelet), using net in NodeJS. TCP server has connections = {} property,...
0
votes
0answers
6 views

Alexa skill sends request to wrong skill

For some reason the Alexa simulator started sending request to other skills. I can invoke my skill, receive the response, then whatever intent I try to use I get an audio only response. I checked the ...
0
votes
0answers
12 views

Problems importing a module to a .js file that I'll run with node through the terminal

I'm build a script that will allow me to visualise all Vue Router's routes on the project. My team took the inspiration from this tool. I have created a script on my package.json file which allows me ...
0
votes
1answer
20 views

mongoose .exec() doesn't work, but promises do

I am trying to add a new entry into a collection and for some reason I am now getting this error! TypeError: newForm.save(...).exec is not a function I've followed this answer, but now for some ...
-1
votes
0answers
9 views

Communication between web services for text web search API? [closed]

Task is to be created database with researched texts from some internet portals. For example, we should research some portals and storage some texts with key words in local database. We need also ...
0
votes
1answer
15 views

How would you encrypt/decrypt numbers in Node.js?

Using Node.js crypto module it is quite easy to encrypt/decrypt strings, as string are readily supported. For numbers you would need to use Buffer/TypeArray or DataView types. How would you encrypt/...
0
votes
1answer
27 views

My async/await function is not waiting in AWS Lambda. What am I missing?

I have a function in AWS Lambda to retrieve user details in Stripe. But the code after the function is executing first. What am I missing? In my case, the function calls a Stripe function that ...
0
votes
1answer
11 views

export module return object with added method

I have the following codes : app.post("/login/auth", (req, res) => { (async function() { let NikitaBellucci = (await auth.login(req, db, crypto))[0]; res.send(NikitaBellucci); ...
0
votes
0answers
6 views

get method with headers for nodejs

DONT WORK const getRemoteData = function (urlMontada) { return new Promise((resolve, reject) => { const client = urlMontada.startsWith('https') ? require('https') : require('http'); ...
0
votes
0answers
8 views

Alexa intent triggered but the reply is “Sorry, I had trouble doing what you asked. Please try again.”

I am using city slots. So, now what i am trying to do is to get alexa speak the city name.But it isn't working. const GetCityNameIntent = { canHandle(handlerInput) { return Alexa....
0
votes
0answers
12 views

Add data to mysql and reload page from modal in node.js

so basically in my web application, i have a student dashboard, with different modals, one of which adds tasks, now, if i want to submit the form from this modal, how should i handle the save to ...
-2
votes
0answers
21 views

How do you use cron scheduler efficiently?

I'm building a booking app and I want to notify the client when things are overdue. I'm currently using React/React-Native, GraphQL, Node, and PostgreSQL. In order to check whether an item is overdue ...
-1
votes
0answers
10 views

How to solve this error in nodejs to remove the error Exit status 2

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance. Assets: index.js (271 KiB) WARNING in entrypoint size limit: The ...
1
vote
1answer
23 views

Unexpected “/” in <filepath> while compiling ejs

I've set up an EJS partial under a path views/partials/ejspartial.ejs which I am trying to access in an ejs file with the path views/ejsfile.ejs. This is the same views directory. In the ejsfile.ejs, ...
0
votes
1answer
9 views

How to send a pdf save on s3 as attachment using Nodemailer

I have a function to send an email with a pdf attach, but when I try send a pdf that no has file locally, the email arrive without any attachment... async sendEmailWithAtt(email, subject, message, ...
0
votes
2answers
39 views

Async/Await nodejs mysql function

I have a problem with nodejs, in practice as you can see from the two modules that I entered via google drive link, I have a problem with the login form because although I have entered asyn / await in ...
0
votes
0answers
10 views

Hygen: Dynamically finding the current working directory that I'm when running the generator engine

I'm using Hygen.io generator engine to generate some files. Currently, I'm trying to generate files in the current working directory. Following the docs, I have tried this: --- to: <%= cwd %>/...