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.
381,454
questions
0
votes
0answers
3 views
How to use Sequelize to get list of fields and their types of a model
For example, if I have a User model with defined fields: {name, location, dob, value}. Is there anyway I can get a list of such data out of a model? Maybe even something like
[ {var: "name" ,...
0
votes
0answers
4 views
Nuxt.js hot reload not working for Vue files on Apple Silicon
Specs
MacBook Air on M1
Node.js natively on ARM via nvm
Nuxt.js project
Everything seems to be fine, except .vue files aren't reloading on change. scss recompiles automatically just fine though, it'...
0
votes
1answer
10 views
Promise completed before file is written
I am extremely new to NodeJS and promises, after a google search found the code below and made it into a promise to read a CSV file using fast-csv, create an array of the data based on the packNr. The ...
0
votes
1answer
14 views
React, update component after async function set
I want to add data and see in below, and also when I start app, I want see added records. But I can see it, when I'm try to writing something in the fields.
The thing is, the function that updates the ...
-1
votes
0answers
10 views
Why isn't highlight.js actively working in Visual Studio Code?
(Let me preface this by saying, apologies if this makes anyone angry; I am not from around here. I do not speak stackoverflow or github, for I am merely a discord peasant who, unfortunately, took on ...
0
votes
0answers
5 views
Auth0 breaks Next.js — pageProps are empty when page is wrapped with withPageAuthRequired HOC
Describe the problem
pageProps supplied via getServerSideProps object is empty when using withPageAuthRequired. I know I must be missing something basic as this must be an extremely common use case.
...
0
votes
0answers
12 views
java jar no show if is running when execute in nodeJs?
In advance forgive me for my poor English.
I am trying to run java jar file in nodeJs, and that looks like it's running but it does not show anything until I again save the project(since I am using ...
0
votes
0answers
5 views
FilePond stylesheet rendering with MIME type text/plain
I am working on a very simple file upload posting site for which I have decided to employ FilePond. Right now I'm just working on getting the form set up so it's ready to accept requests. I am using ...
0
votes
0answers
6 views
Node JS runtime but requires python
I am utilizing https://www.npmjs.com/package/youtube-dl-exec through a simple JS lambda function on an AWS lambda (node 14).
The code is pretty simple and gathers info as per the URL given (and ...
0
votes
2answers
18 views
Delete all nested items in database when deleting a top item using MongoDB and Express
I have three collections in my mongodb: clients, programs, and data. Data is nested in Programs and Programs are nested in Clients. That is a single client can have multiple programs and every such ...
0
votes
0answers
12 views
Как можно использовать библиотеки dll в node.js? [closed]
увлекаюсь разработкой игрового клиента для игры San Andreas MultiPlayer на React.js, Electron.js, TypeScript. Недавно увидел гайд от человека о том, что можно запустить мультиплеер через обычную игру ...
-1
votes
0answers
13 views
Is it possible to send a curl request in jQuery or javascript?
Can anyone help me convert the curl command to request or note fetch?
I want to use an sms api in my application, but they only gave an example as curl, can you help me to use it in my javascript ...
-2
votes
0answers
24 views
Class constructor model cannot be invoked without 'new'
Im setting up my nodejs and graphql api. Using Sequelize as ORM i created my migrations and seeders starting from sequelize-init. Now when i run my app (npm start) an error comes up. I did some ...
5
votes
3answers
33 views
This JS code finds the index of the highest value in an array but how does it work?
The line of code in quesion:
let largest = arr.reduce((a,v,i) => v > a[1] ? [i,v] : a, [-1,0]);
I am confused mainly by this part a, [-1,0], I don't understand this syntax. What is a doing ...
0
votes
0answers
9 views
Deploying MERN app into Azure, have been using “localhost” to run locally
I have been developing a web application using the MERN stack with MongoDB and have been having trouble deploying the app into Azure Web Services. To this point, I have been able to run the app ...
0
votes
0answers
10 views
Test suite failed to run - Cannot find module 'typescript'
I'm trying to get started on running tests but I keep getting this error:
FAIL src/controler.test.ts
Test suite failed to run
Cannot find module 'typescript'
Require stack
project\node_modules\ts-...
0
votes
0answers
5 views
How to use require on client side js with browserify
I've created some module which performs certain task and I am exporting it and I want to use it on client side js. My folder structure is this
I want to be able to use const createRoomId = require(&...
0
votes
1answer
19 views
Nodejs - How to export * from “module”
How to do an export * from "module" in a NodeJS environment that doesn't use ES6 imports?
Do I have to do:
const {a, b, c, d, e, f, g, ..., z} = require("module");
module.exports = ...
0
votes
0answers
6 views
Implementing Date Range filter on a table in React without any libraries
I am currently attempting to implement a date range filter for an existing table without using any external libraries. I looked through stackOverflow and many other websites but couldn't fid any ...
0
votes
0answers
8 views
Form-data posts when testing Postman backend API's - Node / Sequelize / Postgres
I am trying to test my backend API's with Postman and I keep getting either constraint errors (because of Sequelize) or in this case an error saying I am trying to insert "invalid input syntax ...
1
vote
1answer
19 views
How can I extract info from a Map Object?
I am using socket.io 4.x on my NodeJs server and I need to access a few things which are stored in io.sockets.sockets object. So here is what I am looking for how can i get values out of this map, or ...
0
votes
0answers
6 views
Sequelize OP -> TypeError: Cannot read property 'like' of undefined
In my project, i'd like to search many subways have a certain keyword.
So, I use Op in Sequelize, but it returned TypeError: Cannot read property 'like' of undefined.
The way I initialized the ...
0
votes
0answers
11 views
Discord Bot who Disconnected an user from voice channel
I'm Trying to Make my Bot send a Message when someone is Disconnected That contains the one who got Disconnected and the one who Disconnected him.
But when I run the Bot and Disconnect someone Nothing ...
0
votes
1answer
14 views
is there a method of sorting a mongoose model by the sum of 2 fields?
i have those models
[{"trisWin":18,"trisLost":2,"pongWin":4,"_id":"6068c0c237326d13706569aa","username":"Tommaso","password&...
0
votes
0answers
17 views
Reading and writing to JSON files
Having the error of message not being defined, have no clue why. Have been at this for a bit but still pretty new to discord.js. Help would be much appreciated. In effect what I want to do is have an ...
0
votes
0answers
17 views
CSS & JavaScript not loading upon sending the file with Node.JS [duplicate]
The app is working just fine when ran with Live Server on Visual Studio Code, however when I attempt to run node . and go to the site, it comes up just not with the CSS or JS loaded.
Code:
var express ...
0
votes
0answers
4 views
Socket.io Socket.onPacket Error with reverse proxy Nginx
I have a small angular app who comunicate with a node.js server. Both are deployed on aws and I use Nginx reverse proxy to acess the node.js server at the port 4000.
All end-points of the nodejs....
0
votes
0answers
4 views
Express-session losing session after error?
I'm having an issue with express-session. I have a route where I access the user data stored on the session. The route works fine unless an error occurs (either inside or outside of a try/catch block)....
0
votes
0answers
8 views
Why node throws the error: Cannot find module * imported from * using type=“module” in package.json?
Using svelte-kit generator for the first time today generated a package.json with a "type": "module" in it.
Now I wanna call a postbuild script with:
"scripts": {
"...
-2
votes
0answers
14 views
(node:14712) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'info' of undefined… Plz Help Me To solve This
(node:14712) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'info' of undefined
at perProduct (c:\Users\KHADIMUL\Desktop\Product Scraper\scrap.js:1154:41)
at async allProcess (c:\...
1
vote
2answers
19 views
How to check what is included in NPM package
I installed this package: npm install @mediapipe/camera_utils
I would like to know how to find the contents of a package.
0
votes
1answer
14 views
Stripe testing works only on localhost
Stripe testing payment works fine on localhost but when app is deployed to digital ocean testing doesn't work, I'm not getting clientSecret (code below) back.
And I am getting also this error :
Access ...
-4
votes
0answers
14 views
-1
votes
0answers
11 views
How do I run my electron app with cmd in dockerfile?
I have a very very simple electron application, that I am able to run just to typing:
npm start
This works, but now I would like to try to dockerize this. My project structure looks like this:
├── ...
0
votes
0answers
6 views
NodeJs Stream read stream pipe method not work
I have a problem with NodeJs and stream...
I use nodeJs version 12
Error handlers not catch any error :(
Problem: The file output.txt is empty after this code is runned.. And I don't understanding why....
0
votes
0answers
7 views
socket.io error on PlanetHoster - Phussion Passenger
I am stuck on this problem for a long time. I developed a mobile app using socket.io and it works fine on my local. However I am trying to deploy it on PlanetHoster and I am facing this error for ...
0
votes
0answers
7 views
Node.js reports “Use-After-Free” vulnerability with puppeteer
I started a new npm repo (running in an official node docker container), installed the puppeteer package, and got a "high" severity vulnerability warning:
# node --version
v15.13.0
npm --...
1
vote
1answer
17 views
Module not found, Cant resolve serviceWorker in 'React'
I am learning how to use react alongside node.js and have just completed creating a login form for the front end using react.
I am getting the below error message however, despite following the ...
0
votes
0answers
11 views
Testing an image upload to Azure fails in Github actions
I have implemented the packages multer and multer-azure-storage in my express backend to upload images to my Azure storage, which works fine locally and all tests succeed locally.
But when the tests ...
0
votes
0answers
12 views
missing script error during the initialization of a react app
node ./postinstall.js
react-scripts@4.0.3
react@17.0.2
react-dom@17.0.2
added 1922 packages from 732 contributors and audited 1925 packages in 1282.186s
135 packages are looking for funding
run npm ...
0
votes
1answer
13 views
Identifier already declared for Context.sol in Openzeppelin
I am working on an NFT project. I have my NFT fie in my contract folder which is to import from
the openzeppelin files in nodemodules. However, the compiler seem to suggest Context.sol is ...
0
votes
0answers
24 views
res.json returns an empty array
I try to login in my mobile app, here's the back-end code :
// Track logins
log(req, user.id, 'login', 'User successfully logged in.');
// Everything is ok, return the data
...
0
votes
0answers
18 views
Nested Array filter in AWS DynamoDB
I'm new to NoSQL DynamoDB. Trying to build queries for a data model like this
{
"versionName": "1997-edition1",
"bookId": "47",
"...
0
votes
0answers
8 views
Create a directory if not exists in Multer-ftp
I'm trying to create a directory if it does not exists in my multer-ftp.
var multer = require('multer');
const FTPStorage = require('multer-ftp');
const fs = require('fs');
var upload = multer({
...
0
votes
1answer
11 views
Applying semver on mono-repo node js projects
I have used npx semantic-release for tagging projects in GitHub. I am currently working on a project that uses a mono-repo layout, something like:
mono-repo
api
web
mobile
I'd like to generate tags/...
0
votes
0answers
33 views
What is the difference between two request ( PHP -> JS )
Im trying to integrate that api to my website. They shared PHP example, but my project building on node.js. So i am trying to figure out how can imitate that request.
I have same goal with both code, ...
0
votes
0answers
14 views
Nest not working with ts-transformer-keys
I'm trying to use ts-transformation-keys in my Nest application.
I started a new application using a template from this repository, and my machine is running with windows 10.
As described in the ts-...
-1
votes
0answers
10 views
Objeto Json empresa e usuário em um mesmo arquivo [closed]
[ arquivo Json do usuário][1][arquivo Json da empresa][1]
Como fazer um Json com dados para cadastrar várias empresas, por exemplo com os dados: nome, endereço, cnpj... e cadastrar funcionários: ...
0
votes
1answer
6 views
How to add two additional pages to a PDF with one image on each page with NodeJS?
I have a PDF as buffer and two images as base64 string. I would like to add two pages at the end of the PDF and add one of the two images on each of the new pages.
How can this be done? I was looking ...
0
votes
1answer
8 views
ws websocket , Connection has not stublished , https (mixed content)
I am newbie to Websocket i found this project on github, and i want to integrate this project to my old PHP project in plesk vps
client.js
connection.onopen = function () {
console.log("...