Upgrading Node on Glitch?

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!

1 Like

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"
  }
}
2 Likes

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?

image

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.logging 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.

4 Likes

PLEASE donā€™t bump threads. Make a new one.

2 Likes

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!

3 Likes

okay this dope