My Env.: React v17.0.2 node v16.6.1 npm v7.20.3 VS Code Windows 10 The Problem: I am currently working on a cooking recipe app for a friend’s website. My issue is that whenever I enter “node fileName.js” into my terminal to run and check the console.log’s and other outputs for my code,…
Tag: node.js
Client.users.fetch returning “Unknown user”
I’m trying to code a discord bot that send a message to all users in a list. I am having problems using the client.users.fetch(); method on discord.js. The error message says something about DiscordAPIError: Unknown user, Unhandled promise rejection, and DiscordAPIError: Cannot send messages to this use…
Getting Console Messages on Webpage NodeJS
I’m wondering if there’s any way to listen for console messages and act on console messages when they’re received. Mainly, is there any way to do this without an external module, and using the http module? The goal is to trigger a NodeJS function or code snippet on an event like click in the…
How do I fix CLIENT_MISSING_INTENTS error?
I started learning about discord.js, but now I am facing this issue. I tried some googling, but I couldn’t manage to fix it. This is the error I am getting: Answer You need to specify the events which you want your bot to receive using gateway intents. Instead of const client = new Discord.Client(); Use…
URIError: failed to decode param “/%PUBLIC_URL%/favicon.ico”
Please help fix I ran into this error after deploying my webpage to git-pages, now after running my React app it compiles successfully but does not display anything in the browser when you refresh the page this error pops up on the console. link to the React app Answer Please follow the steps given on this re…
TypeError: cb is not a function in nodejs?
(node:13384) UnhandledPromiseRejectionWarning: TypeError: cb is not a function I am using passport js for authentication for my website, I am able to get all routes but when I try to sign up that is post router so in the console I am seeing these err, my data saved in DB but after posting my page loading cont…
Stripe: ERR_BLOCKED_BY_RESPONSE
I’m getting error function redirectToCheckout doesn’t exist. But when I try adding stripe in script tag. It displays this error. This error is happening on stripe script tag in index.html. But even after adding this script tag redrirectToCheckoutout is not a function error still exists. ERROR Inde…
regular expression to capture pdf data in nodejs
I have this code to get specific data from a pdf that is already converted to a string. basically, this is the string i have after that. I need a regular expression that captures de numbers only, I expect something like this: [1308906.95, 230942.51] this is my NodeJS code this is the code I have so far, I wou…
how to find average prices from one array by crossing it to last 30 days from other array? javascript
I have these 2 arrays , one contains the time period, the second one contains the prices for each period. how can I output the average price for the last 30 days, 60 days, etc…? Answer Here I combine the two arrays using map() and make the time into a Data object. I create a Date object and reduce it
How to use date-fns in a Node.js project?
I installed date-fns as per the following instruction on https://www.npmjs.com/package/date-fns After that my package.json is updated with the following entry: Then, I wrote the following code from https://date-fns.org/ and it resulted in error: Error: node -v: Answer I managed to run it successfully by using…