I’m using NodeJs, I’m creating a dynamic property inside an object, and then pushing it into an array. The problem is, when I access the variable via console.log(object[dynamic_property_name]) I can see it in the console, but when I console.log(object) the dynamic property doesn’t show. here…
Tag: node.js
Puppeteer .click hovers instead of clicking
I am using puppeteer to automatically restart my wifi (Linksys Velop) and I can’t seem to click an anchor tag to make the final dialog pop up. After the element is clicked, the anchor tag looks as if it’s being hovered over, with the blue underline. Here is the relevant markup: I have tried page.c…
Read all .md files, convert them to html and send them
I use fs to read the file which is in .md format and I want to transform it into html file. This is my code so far: the file is situated in that folder and has that name. This function puts in console the content of the .md file. For converting it to html I added this: It puts the
Use gulp files from other npm packages (import files which will eventually exist)
I have one npm package containing several files with several gulp task definitions. What I want is in the main gulpfile, be able to copy these gulp files (from the package) and execute the gulp tasks defined in them. Follows an example: The problem is: When I try to execute gulp debug, it is retrieved an erro…
How to make Discord Bot make sure your pinging someone in a command
I’m trying to make the bot say the name of someone I pinged and give that person a role. Right now, if you don’t ping someone, the whole bot breaks. Here is my code: Answer I see a few problems with your code: First of all, else if() will always return an error. Second of all, you should switch th…
Some of the Express public files are not accessible on localhost
When I run my Node.js app on localhost, I can access for example http://localhost:3000/css/dashboard.css However, if I put a logo.png to the same directory and try http://localhost:3000/css/logo.png on my browser, I only get “Cannot GET /css/logo.png”. I tried with several browsers. In my app, the…
Why am I getting this UNEXPECTED HTTP error in NodeJS
So guys i’m setting up my backend in NodeJS for an e-commerce website. But I ran into an error trying to implement the “Order” method. First the connection to mysql database : Then in my Models there is a Client class that contains the following method : The orderData parameter in the order(…
script ends despite unresolved promise
Consider this: The scripts terminates at the await and the log is never printed to sdout, I don’t understand why Answer Nothing is wrong with your code. That’s just the model of Node. If there is no pending I/O pending promises don’t prevent Node from exiting. You can schedule some I/O if yo…
discord.js setting permission on channel to “/” (neutral)
I am looking to set user permissions on a text channel to neutral/null/”/” but overwritePermissions() seems to only use allow and deny currently, a past post I saw showed setting the value to null but allow/deny seems to prevent that. I am setting permissions on a text channel like this: and would…
cors error even after allowing all origins *
i have a post request on my at http://localhost:3000 and request resources from http://localhost:5500 even after allowing all origins it gives error. I’m stuck on this for a few hours now please help. i get this error this is where i’m setting my header this is my fetch request Answer Try below. A…