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!

2 Likes

okay this dope