I am learning react and find myself running npm start on the terminal a couple of times but its annoying how it opens a new browser window everytime. I’m trying to stop this from happening on linux. I found a solution for how to do this on Windows, but how can I do it on Linux? Answer Adding BROWSER=non…
Tag: node.js
Next.js – best way to serve static JS from a node module’s “dist” folder
I’m working with an application that uses Tesseract (OCR) to read text from images. I would like to take some JS files from node_modules/tesseract.js/dist and make them downloadable in the browser. I know I can just copy the files to ./public and next.js will serve it statically from there, but then if …
member cannot be mentioned in the embed discord.js v13
I was making a join and leave log system that returns a specific embed when someone joins/leaves the server. but when the bot sends the embed in the channel, the member is not mentioned. My code: Notes: No one can see the channel that I am sending this embed to, just me and the bot I am using discord.js v13
Resolving a promise to multiple parameter values
Is it possible to resolve a promise in such a way that the next promise in the chain can be an executor that takes multiple parameters? For example, say I have a function that takes three parameters: If I’m including it in a chain, e.g. one of these: Is there something I can return (in place of /* ??? *…
How to filter the member counter in discord.js v13
I made a member counting system for my server but it counts every member that is joined. I want to filter the counter to just count the humans/users My code: I am using discord.js v13 and node.js v16 Answer You can just filter through all the members in a server and remove all the members which are bots by ch…
How to get immediate child of using cheerio
I have html file html content like this : After Loading html content in cheerio module and while searching for immediate li childs it’s getting all items from child ul as well like this : When i print liElements in after converting to html content i am getting output like this : You can see content from…
Can I have the params with an empty object with getStaticPaths?
In the getStaticPaths function, there is a path returned with params postId:1. If have two or three more params with postId: 2, postId: 3 etc. those will be statically generated. Right? Is there a way not to statically load any post with any id? If I want to load all the posts with the loading screen, is that…
Nesting for loop automatic
I have a array with objects and those objects consist of some arrays. I wanna loop through the entire array and the array inside the objects. Sound complicated but if you look at the example below it works. However my problem is that right now the length of the variables array is 2, but how can i implement so…
Can’t get single item to delete by id from mongoDB in nextjs app
I’m making a todo app in nextjs to practice, and I am having a hard time getting single todos to delete from the database using the deleteOne function. Here is the call from the front end: and here is the handling of the DELETE method: and the deleteTodo helper function it calls: I can get it to delete …
Command ‘Solidity: Compile Contract’ resulted in an error (Cannot read properties of undefined(reading ‘uri’))
Good day everyone, I am working on a lottery smart contract. I am currently done with the remix VM tests and proceeded with the unit tests with JavaScript. The test.js file is shown below. The test file for now only checks if the contract deploys, pretty simple. However, I have not been able to proceed from h…