And how does one update the nodes onto glitch - instructions for the not tech savvy please
Hey @Rahera, welcome to the Glitch forum!
You can see what Node versions are currently available on Glitch using this community-created project. To choose from among those different versions you can add a block like this to your projectās package.json
file:
"engines": {
"node": "8.x"
},
That block will instruct Glitch to use Node v8.15.1. You can see that in action at https://glitch.com/edit/#!/anonymous-anaconda?path=package.json:17:0, and https://glitch.com/edit/#!/cori?path=package.json:19:0 shows what that would look like to use Node 12.0.0.
If you select a version that Glitch doesnāt currently support (or donāt select one at all) Glitch will use its default, which is currently 10.15.3.
Hope this helps!
my āpackage.jsonā says
{
"name": "Discord-Bot-Maker-Bot",
"author": "Robert Borghese",
"main": "bot.js",
"scripts": {
"start": "node bot.js"
},
"version": "1.2.9",
"dependencies": {
"discord.js": "^11.3.0",
"fstorm": "^0.1.3",
"jimp": "^0.2.28",
"express": "^4.16.4"
}
}
MOD EDIT: formatting
In that case youāll be using the latest version of Node v10 that we have installed (currently v10.15.3) since you donāt otherwise specify. If you wanted to upgrade to Node v12 your package.json could look like this:
{
"name": "Discord-Bot-Maker-Bot",
"author": "Robert Borghese",
"main": "bot.js",
"scripts": {
"start": "node bot.js"
},
"engines": {
"node": "12.x"
},
"version": "1.2.9",
"dependencies": {
"discord.js": "^11.3.0",
"fstorm": "^0.1.3",
"jimp": "^0.2.28",
"express": "^4.16.4"
}
}
hmm Im not actually sureā¦
Ive been getting lots of node errors in the last month, and someone said I needed to update them.
What would you suggest?
Ah, I see what youāre running into!
Those arenāt messages from Node itself - itās a little hard to tell from that little screenshot, but those are probably errors from one of the libraries that youāre using thatās still using Node features that are being discontinued. If those are from a package youāre using (they look like ones I see from discord.js from time to time, for instance) then thereās nothing you can do about them without rewriting the parts of the package that are violating those rules - they need to be fixed by the package authors.
Luckily in these cases theyāre ājustā warnings, but eventually those things will stop working in the package arenāt updated.
You may be able to downgrade your node to version 8.x
which may silence those messages - that might be worth a try although itās possible it would break other aspects of your project.
ahhh so what you telling me is either way im stuffed lolā¦ codes that did work no longer work, I cant work out how to transfer more than 99files in a folder from githubā¦ I should just shoot myself now lol
You speak of a packageā¦ what parts need to be rewritten? Is this something your aware of or something I cant do anything aboutā¦
and btw that you so much for your help
What Iāve seen in some circumstances with the discord.js package is that it uses some features of Node that are being discontinued and it hasnāt been updated to remove these ādeprecatedā features yet. Rewriting those yourself is probably not a reasonable approach, but itās the only way to āfixā the issues yourself - the package owners will need to fix those problems at some point or the package will eventually just stop working.
That said, none of those messages should be causing your project to break - they just kind of get in the way of finding out the real problems.
Can you share your project name so someone can take a closer look to see if we can help (I canāt find it based on the name in the package.json
file)?
Project names are Memnoch and Pandora1
Hmm they do stop the commands from working, or I wouldnt be worried about it
They are both discord bots if that helps
sorry for the long reply time
Ok, Iām not seeing any errors in ~pandora1 but Iāll watch for a bit to see if I can see it happen.
On ~memnoch thereās a different error in the logs right now having to do with the input to your onMessage
event handler at https://glitch.com/edit/#!/memnoch?path=bot.js:144:0 - it looks like itās trying to handle a message thatās not valid for some reason, although thatās largely a guess. You might consider console.log
ging msg
in that handler to see whatās in there that your botās code doesnāt like.
The collection.find feature in discord.js has been updated, youād need to change something like client.guilds.find("name", "CoolServer")
to client.guilds.find(g => g.name === "CoolServer")
. It isnāt related to the Node.js version, itās just a Discord.js update. Currently the old way will still work but in a future update the old way will stop working.
Im sorry, I really am, but im old and have been playing with tech for 2mths maxā¦ how would I do these things?
Welcome to the Glitch Support Platform, @Rahera!
Due to the new version coming up, theyāve removed the property-passing method from the Collection.find()
function in Discord master version, that is.
Thus, they are just mere warning for now - you do not have to worry about them for now.
Even so, Iād recommend you to change all Collection.find()
function and pass a function instead of passing property to them:
Collection.find('name', 'collection-name');
Change the above code to:
Collection.find(ting => ting.name === 'collection-name');
Having said that, IT IS perfectly fine to ignore the warnings for now. Youāll have to eventually and gradually update the code as you upgrade the Discord.js version. Besides, it is not Node.js errors, perhaps, that of, discord.js.
Hope this helps!
[FIXED]
I did what you said, I changed it to ā12.0.0ā, and refreshed my project using the terminal (refresh
), checked the node version using node -v
, still returned the default 10.15.3 version. Any help on this?
[FIXED]
Also a quick warning to whoever reads this thread
do not use any package with keepalive in the name they will get your project suspended. Glitch has made this very clear and your project has a chance of never getting unsuspended after that.
PLEASE donāt bump threads. Make a new one.
Iām sorry does node.js 16 supported yet?
Hi @IHZAQSTORM33,
Yes, you can use Node 16 by adding this section into your package.json
:
"engines": { "node": "16.x" },
Hope it helps!
okay this dope