Discord bot sends response twice - node.js

I'm coding a discord.js bot, and whenever I send a command, it gives a response twice. I've concluded it's because I have too many instances running. I try to delete the instances, but it doesn't delete. Sometimes it says "Some instances could not be deleted", and sometimes it doesn't delete at all.
And through Terminal
SERVICE VERSION ID VM_STATUS DEBUG_MODE
default 20191208t223728 aef-default-20191208t223728-0l57 RUNNING
default 20191208t223728 aef-default-20191208t223728-jb53 RUNNING
default 20191208t223728 aef-default-20191208t223728-wpgm RUNNING
This is what the messages look like. There should only be one message, not three.
Here is what my package.json looks like:
"name": "discord-bot",
"version": "1.0.0",
"description": "Custom bot for Chinese Discord server.",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js",
"build": "next build"
},
"keywords": [],
"author": "Jacob Villorente",
"license": "ISC",
"dependencies": {
"discord.js": "^11.4.2",
"discord.js-commando": "^0.10.0",
"dotenv": "^7.0.0",
"express": "^4.17.1",
"node-fetch": "^2.6.0",
"ytdl-core": "^1.0.3"
},
"devDependencies": {
"nodemon": "^1.18.11"
}
}
Any help would be greatly appreciated. Thank you

There are two ways to resolve your problem.
The first one, and the better, is to use grep to get all your node processes who are running on your machine:
ps -ef | grep node
Then, you will be able to kill them with kill command.
The second way is to change your discord bot token. All the instances will be errored so you're sure there's no instance launched anymore.

Related

Parcel showing ENOENT: no such file or directory error when I save my html

beginner web dev here, first time using parcel and sass.
So, I have the parcel set up, but when I change and save the src/index.html, terminal shows me this error, instead of changing the dist/index.html.
It is very weird because in the error, there is supposed to be a file called dist/index.html.9424.5, which really does not exist in my case.
Here is my package.json set up:
{
"name": "calculator_project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "parcel src/index.html",
"build": "parcel build src/index.html"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#parcel/transformer-sass": "^2.7.0",
"parcel": "^2.7.0",
"sass": "^1.55.0"
}
}
Also, this is my folder structure and html
I will be very thankful for any tips or solutions.
Also, I am very sorry if I documented this error incorrectly, I am still pretty new to this.
Thanks for reading and help!

NPM version discrepancy between main version and cpanel version

When running npm-version on my local server/laptop I receive 7.5.6
However, when running on cpanel terminal -- I receive
[~]# /opt/cpanel/ea-nodejs10/bin/npm --version
6.14.11
And this 6.14.11 is after I ran
[~]# /opt/cpanel/ea-nodejs10/bin/npm install --latest version -g
Which I thought would update it to the 7.5.6 as I used the same command to update the one on my computer as well.
In all I'm having trouble deploying my webapp on bluehost via cpanel. Even though the app is registered with the application manager -- and the Ensure Dependencies part came out done and successful. And the git repo is cloned and deployed with no errors.
Would this discrepancy be causing the app not to launch?
I can't understand why it isn't deploying properly, so I was thinking there may be something with the package.json or (package-lock.json) -- ei - could the versions in such bet preventing deployment due to discrepancies.
Would love some help, been trying to get this deployed for days!
my package.json
{
"name": "vandenbergdevelopment",
"version": "1.0.0",
"description": "DeltaDesignServer",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"author": "J Vandenberg",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"ejs": "^3.1.6",
"express": "^4.17.1",
"firebase-tools": "^9.5.0",
"hover.css": "^2.3.2",
"nodemailer": "^6.4.18",
"nodemailer-mailgun-transport": "^2.0.2",
"version": "^0.0.4"
}
}
The top bit to the lock.json
"": {
"name": "vandenbergdevelopment",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"version": "^0.0.4",
"body-parser": "^1.19.0",
"ejs": "^3.1.6",
"express": "^4.17.1",
"firebase-tools": "^9.5.0",
"hover.css": "^2.3.2",
"nodemailer": "^6.4.18",
"nodemailer-mailgun-transport": "^2.0.2"
}
},
Thank you!

Node.js - Command npm run dev is stuck on message "Compilation complete. Watching for file changes"

When I launch npm run dev on my project, the process is stuck on the message below:
Compilation complete. Watching for file changes
and the server is not started.
I have the problem only on my Windows. When I launch the same command on my Ubuntu virtual machine, the server start as expected.
Do you know what how could I investigate more, have some logs or indications about the "error" ?
Thank you very much.
can you post your package.json file?
it is important, your script part is definded like that:
{
"name": "snail",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "nodemon app.js",
"dev":"node app.js"
},
"dependencies": {
"body-parser": "^1.19.0",
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
}
}
app.js is the filename of yout startfile.

Build node.js app using yarn but getting error Command "build" not found

This is my package.json file.
{
"name": "moneymall",
"version": "1.0.0",
"description": "A money mall server app.",
"main": "index.js",
"author": "Anbu Selvan",
"license": "ISC",
"keywords": [],
"dependencies": {
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"e": "0.0.4",
"express": "^4.16.4",
"mysql": "^2.16.0",
"pug": "^2.0.3",
"yarn": "^1.15.2"
},
"devDependencies": {
"nodemon": "^1.18.10",
"react-scripts": "^2.1.8"
}
}
Run yarn build and get this error.
yarn run v1.15.2 error Command "build" not found. info Visit
https://yarnpkg.com/en/docs/cli/run for documentation about this
command
You don't seem to have a script.build key defined in your package.json file. Sample entry for building with webpack library would be:
"scripts": {
"build": "webpack"
}
If you execute yarn run it will show the list of commands which can be run.
Ideally yarn run dev will do the trick of compiling the build
Please re-read the yarn documentation. You don't seem to have a script key declaring what you build script is, and thus Yarn does not know what to load.

Heroku deployment fails with "missing script: start"

I am trying to upload my local MEAN stack based web application to my Heroku server. I have updated my code in Bitbucket and have successfully done the Heroku deployment part. But, the web app is still not live. When I hit the page, I am getting something like this:
I then checked the logs by firing 'heroku logs' but I am unable to understand what the logs are trying to ask for. I am sharing the logs below:
As I understand it, the application was unable to find "start" but I have later exclusively added "start" : "node app.js" but I still don't see any difference in the heroku logs or in the heroku link.
Can anyone help with what am I doing wrong here?
here's my package.json file
{
"start": "node app.js",
"name": "PerosnalPro",
"version": "1.0.0",
"description": "Personal website using dynamic routing and responsive design.",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Mikey",
"license": "ISC",
"dependencies": {
"dotenv": "^1.2.0",
"ejs": "^2.3.4",
"express": "^4.13.3",
"morgan": "^1.6.1",
"serve-favicon": "^2.3.0",
"slick-carousel": "^1.5.9"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://user#bitbucket.org/username/projectname"
},
"homepage": "https://bitbucket.org/username/projectname"
}
"scripts": {
"start" : "node app.js",
"test": "echo \"Error: no test specified \" && exit 1"
}
Add your start tag in scripts. :)

Resources