Create a Music Discord Bot using Discord JS

Поделиться
HTML-код
  • Опубликовано: 17 окт 2024

Комментарии • 186

  • @Computeshorts
    @Computeshorts  2 года назад +19

    What other discord bots would you like me to make?

    • @feeninher
      @feeninher 2 года назад +2

      could you help me? whats your discord

    • @SpaceHero1000
      @SpaceHero1000 2 года назад +3

      @Computeshorts how can we run the music bot on multiple servers

    • @Computeshorts
      @Computeshorts  2 года назад +3

      @@SpaceHero1000 if your bot is begining to be slow and you want to spin up multiplr instances then you shohldnt need to do any adjustments to the code and simply start multiple instances of the program. If your bot needs connection to over 2500 servers then you will need to have a look at sharding discordjs.guide/sharding/#when-to-shard

    • @SpaceHero1000
      @SpaceHero1000 2 года назад

      @@Computeshorts how would you run an instance per server ?

    • @Computeshorts
      @Computeshorts  2 года назад +1

      @@SpaceHero1000 just starting everything up as usual with either the node . Command or by using the docker container.

  • @theshortbowwithmasterwork2832
    @theshortbowwithmasterwork2832 Год назад +22

    FOR ANYONE GETTING THE "CREATEQUEUE IS NOT A FUNCTION" ERROR: that part of discordjs has been updated. Replace it with "client.player.queues.create(interaction.guild)"
    Be aware I'm myself not done with this tutorial so I'll update the comment (probably) if any other stuff comes up.

    • @rimi4014
      @rimi4014 Год назад

      hello, so are u fix this problem? I think that "client.player.queue.create(interaction.guild) doesn't work at all in my case cuz in result we get queue undefined

    • @theshortbowwithmasterwork2832
      @theshortbowwithmasterwork2832 Год назад

      @@rimi4014 oh yeah there is a typo on my part. it is queues not queue.

    • @rimi4014
      @rimi4014 Год назад

      @@theshortbowwithmasterwork2832 can you give me link to your code pls?Now i have ner error TypeError: MessageEmbed is not a constructor

    • @theshortbowwithmasterwork2832
      @theshortbowwithmasterwork2832 Год назад

      @@rimi4014 My code is not bug free yet as well, but MessageEmbed got replaced by EmbedBuilder()

    • @johannbotha5740
      @johannbotha5740 Год назад

      You are a national treasure

  • @sunnygarf
    @sunnygarf 9 месяцев назад

    cheers for the short and sweet tutorial!

  • @hiqqoqotamus
    @hiqqoqotamus Год назад

    What version of the discord api are you using I'm getting an error and I think I might have to downgrade. Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in node_modules/discord-api-types/package.json

  • @zSullyy
    @zSullyy Год назад +3

    Hey, I got the following Error:
    "TypeError: command.execute is not a function"
    ... what should I do now? I also tried command.run but it got the same error

  • @xxkenxyz666
    @xxkenxyz666 2 года назад +1

    is this bot able to play songs from spotify?

    • @Computeshorts
      @Computeshorts  2 года назад +2

      Not at the moment but you could use the Spotify api to add this feature in.

    • @037tangerino
      @037tangerino Год назад

      @@Computeshorts How can I use the Spotify API?

  • @horssentc
    @horssentc Год назад +13

    TypeError: Cannot read properties of undefined (reading 'createQueue')
    How can I fix this?

    • @Zaggloobz
      @Zaggloobz 21 день назад +1

      "CREATEQUEUE IS NOT A FUNCTION" ERROR: that part of discordjs has been updated. Replace it with "client.player.queues.create(interaction.guild)"

  • @real.daniello
    @real.daniello 5 месяцев назад

    Hello, I use discord.js v13.5 and discord-player 3.3.1 | I get this error TypeError: client.player.createQueue is not a function in play.js

  • @037tangerino
    @037tangerino Год назад +3

    How can I make the bot grab music from a platform other than YT?

  • @Matt-ui2bm
    @Matt-ui2bm Год назад +4

    i keep getting an error that getQueue is undefined, but i logged the queue into the console and can confirm that the queue is getting data. for whatever reason, its not reading it in. any ideas?

    • @ferreira..
      @ferreira.. Год назад +1

      managed to solve? If yes, help me please.

  • @gabs9324
    @gabs9324 2 года назад +3

    on mine it is giving the error TypeError: Cannot read properties of undefined (reading 'name') in client.commands.set(command.data.name ,command); what can i do to solve it?

    • @nicosnico69
      @nicosnico69 Год назад

      you haven't names your command

    • @oofsoul7471
      @oofsoul7471 Год назад

      i also experience the same problem

    • @lordpotaynut2283
      @lordpotaynut2283 Год назад

      I just went through ALL of my commands and found the error: You have to make sure that every one of your commands is properly formatted and says "module.exports" instead of "module.export". If ONE SINGLE COMMAND isn't formatted correctly it'll throw that error every time you run it no matter what.

  •  11 месяцев назад +2

    Hello, can you make a video showing me how to deploy a bot to AWS so it can run 24/7?

  • @justbobdude4742
    @justbobdude4742 2 года назад +3

    How do you define the FLAGS even. since your own code gives me the same typeError: Cannot read properties of undefined (reading 'FLAGS')

    • @Computeshorts
      @Computeshorts  2 года назад +1

      Did you import intents from discord.js? Also you'll need to make sure to say Intents.FLAGS.flagname. Have a look at this file github.com/pawel02/discord-js-music-bot/blob/main/index.js especially line 5-13

    • @justbobdude4742
      @justbobdude4742 2 года назад

      @@Computeshorts Hi thanks for replying heres my code which is exactly copied still get the same error i've imported everything written in the video
      require('dotenv').config();
      const {REST} = require('@discordjs/rest');
      const { Routes } = require('discord-api-types/v9');
      const { Client, Intents, Collection } = require('discord.js');
      const { Player } = require("discord-player");
      const fs = require('fs');
      const path = require('path');
      const client = new Client({
      intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES]
      });
      this is line 1 to 14 and i still get the same error

    • @Computeshorts
      @Computeshorts  2 года назад +1

      If you're using discord js v14 then this might be the answer stackoverflow.com/a/73054552/7175167

    • @justbobdude4742
      @justbobdude4742 2 года назад

      @@Computeshorts hey thanks for replying i'm guessing since i coded on something like v14 i might have more problems cuz now the bot goes online but instead it gives me an error while trying to play a playlist that interaction.isCommand is not a function and thats for the interaction create im guessing fixing this might fix the entire thing!
      But the flags problem is now fixed with that so thank you. but if you have anything solvable around "interaction.isCommand" is not a function please tell me!

    • @Zirogato
      @Zirogato Год назад

      @@justbobdude4742 Im not sure at 100% but you can try to add : "const { InteractionType} = require("discord.js") and change line to : "if(!InteractionType.ApplicationCommand()) return;"

  • @Slleide
    @Slleide 11 месяцев назад

    the bot works, but after about 30 seconds of play it just stops and dont post any error on console

  • @dr_bluegaming
    @dr_bluegaming 9 месяцев назад +1

    My bot automatically logs out after 60 seconds :(

  • @panzerjagertigerpelefant
    @panzerjagertigerpelefant 10 месяцев назад

    Any clue what's gone wrong? I get this error.
    node:internal/modules/cjs/loader:573
    throw e;
    ^
    Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in C:\musicbot
    ode_modules\discord-api-types\package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:359:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:695:9)
    at resolveExports (node:internal/modules/cjs/loader:567:36)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object. (C:\musicbot\index.js:4:18) {
    code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
    }
    I'd appreciate any answers as to how to solve it.

    • @EmptyPain1
      @EmptyPain1 6 месяцев назад

      sign up for chatGPT it fixes all your coding mistakes and tells you what wrong and how to fix it

  • @DarioSusanj505
    @DarioSusanj505 Год назад

    The bot stops playing the song after ~1 min, always at the same time, with no errors in the console. Has anyone encountered this problem and knows how to fix?

  • @VodaFelix
    @VodaFelix 9 месяцев назад

    Hello, sorry, I get an error on this line:
    execute: async ({client, interactor}) => {
    In the skip file you know what it can be

    • @Mumin._.
      @Mumin._. 7 месяцев назад +1

      No one will just guess your error, send the error code

  • @Denis091294
    @Denis091294 Год назад +6

    It is a really good tutorial. Thank you!

  • @fawnie1085
    @fawnie1085 Год назад +2

    TypeError: client.player.createQueue is not a function any fixes?

    • @megvzx6590
      @megvzx6590 Год назад +1

      im stuck on this aswell

    • @fawnie1085
      @fawnie1085 Год назад

      @@megvzx6590 brother save yourself dont do this video

    • @charminarchaupal
      @charminarchaupal Год назад

      // Create a play queue for the server
      const queue = await client.Player.nodes.create(interaction.guild);
      // Wait until you are connected to the channel
      if (!queue.connection) await queue.connect(interaction.member.voice.channel)
      let embed = new EmbedBuilder();

    • @charminarchaupal
      @charminarchaupal Год назад

      heres the solution
      // Create a play queue for the server
      const queue = await client.Player.nodes.create(interaction.guild);
      // Wait until you are connected to the channel
      if (!queue.connection) await queue.connect(interaction.member.voice.channel)
      let embed = new EmbedBuilder();

    • @LoveMyBomber
      @LoveMyBomber Год назад

      @@charminarchaupal what is nodes?

  • @ashishitD
    @ashishitD 9 месяцев назад

    error when installing opus
    i went to the github page to see and it ways the build is failing what to do?

  • @PwNzDeLeOn
    @PwNzDeLeOn Год назад +4

    could you post an updated guide?

  • @radimx61
    @radimx61 Год назад

    my bot won't connect to voice chat, do you know how to fix it?

  • @WhoIsRidhoo
    @WhoIsRidhoo 8 месяцев назад +1

    i have problem from npm i @discordjs/opus, Can u help me King 🙏

  • @ivanliew525
    @ivanliew525 Год назад +1

    I got the error queue.play() is not a function, anyone has this issue as well and know how to solve it?

    • @Ivaylo1
      @Ivaylo1 Год назад +1

      same :/

    • @okanbasyigit
      @okanbasyigit Год назад

      "if (!queue.playing) await queue.play()" change this code to " if (!queue.node.isPlaying()) await queue.node.play(),"

  • @traydenpelham9425
    @traydenpelham9425 2 года назад +1

    at 9:54 how do you go from line 43 and push it up like that

  • @rizking1103
    @rizking1103 Год назад

    Error: Cannot find module 'discord-player'
    Require stack:
    why????? helpp me

    • @ricardomorim9444
      @ricardomorim9444 Год назад

      u didn't installed it at the beggining probably, try to install it as he said in the node packages

  • @packofilms
    @packofilms 2 года назад +2

    There is no audio in the bot, how can I make it listen?

    • @Rikent
      @Rikent Год назад

      did you find a solution?

    • @037tangerino
      @037tangerino Год назад

      The bot takes music from YT that is the reason

  • @lordpotaynut2283
    @lordpotaynut2283 Год назад +2

    Finished the tutorial, ended up having so many problems I just had to go to Github and copy the code from there, and even with that it doesn't work properly! Eventually I got the bot to connect to the voice channel, but no matter what RUclips link I put in it just said it couldn't find the video. Unfortunately a complete waste of 3 hours of my time, but I don't know if it was the tutorial or the libraries at this point. Don't bother with Discord bots.

    • @alex_turing
      @alex_turing Год назад +1

      Me too but I didn't expect this to work right away. That's how it is with old videos. You got to do some more debugging and check documentations. Still trying to solve the couldn't find the video problem, reply to this if you want to know the solution and I will send it later.

    • @00play29
      @00play29 Год назад +1

      @@alex_turing came the decision please

  • @medi573
    @medi573 Год назад

    Any idea why the audio sounds so terrible as well as distorted / laggy?

  • @diwangmittal8067
    @diwangmittal8067 Год назад

    9:54 what the goofball did just happen your code removed 1 line?

  • @DoomeR18G
    @DoomeR18G 5 месяцев назад

    I have error when im installing @discordjs\opus. something about python

  • @polsereyrith7555
    @polsereyrith7555 Год назад

    this keeps happening Uncaught Error Error: Cannot find module 'dotenv'

  • @bloodysh6080
    @bloodysh6080 Год назад

    hi, my bot goes online but doesnt show my commands!

  • @ZTBaByy
    @ZTBaByy Год назад

    TypeError: Cannot read properties of undefined (reading 'GUILDS') why?

    • @shaotihk6445
      @shaotihk6445 Год назад +1

      It might be due to restriction on intents. Go to the developer portal and find your application. Go to bot section and enable the privileged gateway intents

  • @toddydog23
    @toddydog23 Год назад +1

    Does anyone else have the problem of queue.skip() skipping 2 songs? I have tried everything

    • @shaotihk6445
      @shaotihk6445 Год назад +1

      I have this not-so-optimal fix. Basically you duplicate the song every time you try to queue one

    • @britannia6690
      @britannia6690 Год назад +1

      The better fix is use discord player 5.3.2

  • @fynx36
    @fynx36 Год назад +2

    Does anyone have an idea how I can fix this error?
    (node:8304) [NoExtractors] Warning: Skipping the execution of extractors because no extractors were registered.

    • @ricardoreyes9348
      @ricardoreyes9348 Год назад +1

      Did you fix this? If so, what was wrong?

    • @JohnSmithino
      @JohnSmithino Год назад +1

      I have the same problem and cant seem to find out how to fix it

    • @NoXvall
      @NoXvall 10 месяцев назад +1

      did you fix this? i need help to solve this problem

    • @perfectlkm
      @perfectlkm 6 месяцев назад

      Add "client.player.extractors.loadDefault();" after "client.player = new Player(client, {
      ytdlOptions: {
      quality: "highestaudio",
      highWaterMark: 1

  • @tannerwoslager
    @tannerwoslager 2 года назад +1

    I do not get how to download the ffmpeg

  • @roll3r916
    @roll3r916 Год назад +1

    gotta leave a comment on this one, new pesron TURN BACK DONT DO THIS TUT, esp if u new to coding, this filled with bugs.

  • @rylsdark
    @rylsdark Год назад

    Bot connects but doesn't play anything. Any help?

  • @Rioni
    @Rioni 2 года назад

    __dirnmae give me error (it says it's not defined in ES module scope)

    • @gazelle1056
      @gazelle1056 2 года назад

      If you copied his code line by line, and you copied and pasted the error, it's most likely due to a typo.
      "__dirnmae" should be "__dirname". (dirname = directory name)

    • @Rioni
      @Rioni 2 года назад

      @@gazelle1056 ups, I mistyped it here. I wrote it __dirname but since I'm writing using EMS standard instead of cjs I got an error. I was able to solve it looking in stackoverflow

  • @iRofu
    @iRofu Год назад

    Anybody knows why im getting this error?
    TypeError: client.player.createQueue is not a function
    at Object.execute (C:\Users\\Desktop\\discord-bot\commands\play.js:34:37)
    at Client. (C:\Users\\Desktop\\discord-bot\index.js:60:23)
    at Client.emit (node:events:513:28)
    at InteractionCreateAction.handle (C:\Users\\Desktop\\discord-bot
    ode_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)

    • @daniRembrandt
      @daniRembrandt Год назад +1

      Hi, I got the same error and it seems that this function doesn't exist in the latest version of discord-player. I tried downgrading it to 5.3.2 that has it. The error has disappeared but now I can't seem to be able to make the bot play any music, it just joins the channel and stays there without playing anything

    • @fawnie1085
      @fawnie1085 Год назад +1

      im getting the same im using discord.js v13 and discord-player v3 and still getting this error

    • @crehera
      @crehera Год назад

      const queue = await client.player.nodes.create(interaction.guild); use this

  • @Imduckbybtw
    @Imduckbybtw Год назад

    i just got blocked😥How can i solve that.

  • @gabrielklbr
    @gabrielklbr 2 года назад +1

    How can I do for the bot always stay activated?

    • @Computeshorts
      @Computeshorts  2 года назад +1

      You'll need to deploy it to a server that runs 24/7 there are many cloud providers out there such as aws, gcp or azure and most of them offer a free tier

    • @gabrielklbr
      @gabrielklbr 2 года назад +1

      ​@@Computeshorts Thanks but before you answer me i watched a video how to host and i do with Heroku but thanks

  • @dibll0835
    @dibll0835 2 года назад +5

    TypeError: Cannot read properties of undefined (reading 'FLAGS')

    • @meme4memes
      @meme4memes Год назад

      same , find any fix ?

    • @matthewcollett2281
      @matthewcollett2281 Год назад +2

      Intents changed to GatewayIntentBits, and then you can change it like such
      const client = new Client({
      intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates]
      });

    • @matthewcollett2281
      @matthewcollett2281 Год назад

      @@meme4memes see thread

  • @Adraiox2014
    @Adraiox2014 7 месяцев назад

    can spotify play song links?

  • @unhxppiness
    @unhxppiness 9 месяцев назад

    hey why are you just not installing ffmpeg npm library ?

    • @unhxppiness
      @unhxppiness 9 месяцев назад

      instead of all of this system option tweaks

    • @unhxppiness
      @unhxppiness 9 месяцев назад

      i enjoyed the video tho :)

  • @pjdj4027
    @pjdj4027 2 года назад +1

    tutorial on how to use with docker?

  • @Stella-yb5jh
    @Stella-yb5jh Год назад

    slash commands do not appear in discord:(

  • @BryceTheFire
    @BryceTheFire Год назад +2

    bro whyd you speed it up at the stuff bruh your goofy

  • @NikolaToncev6ix
    @NikolaToncev6ix Год назад

    ReferenceError: EmbedBuilder is not defined
    is the error i get

  • @evancio
    @evancio 2 года назад +2

    I always get this error on Player.js
    TypeError: discord_js_1.IntentsBitField is not a constructor

    • @fuwaakira516
      @fuwaakira516 2 года назад +1

      i got a error rlly similar, what i did to fix it is use "GatewayIntentBits" instead of "IntentsBitFields"
      here code:
      const { Client, GatewayIntentBits, Collection } = require("discord.js");
      const client = new Client({
      intents: [
      GatewayIntentBits.GuildMessages,
      GatewayIntentBits.Guilds,
      GatewayIntentBits.MessageContent,
      GatewayIntentBits.GuildVoiceStates,
      GatewayIntentBits.GuildPresences,
      GatewayIntentBits.GuildMembers,
      GatewayIntentBits.GuildScheduledEvents,
      GatewayIntentBits.GuildMessageReactions,
      GatewayIntentBits.GuildVoiceStates,
      ],
      });
      you will obviously replace the intents for which you are gonna use

    • @shaotihk6445
      @shaotihk6445 Год назад

      @@fuwaakira516 I am now getting a TypeError: Cannot read properties of undefined (reading 'GuildMessages')

    • @fuwaakira516
      @fuwaakira516 Год назад

      @@shaotihk6445 You have to autorize your bot to read messages, i had that one too, there are youtube video to solve them so dont worry, its not hard

    • @shaotihk6445
      @shaotihk6445 Год назад +1

      @@fuwaakira516 Thank you. It turns out I didnt allow intents.

  • @lakindulorensuhewa
    @lakindulorensuhewa 23 дня назад

    bro slow down any one can't understand when you telling this much fast slow douwn

  • @pump9102
    @pump9102 Год назад +3

    TypeError: Cannot read properties of undefined (reading 'FLAGS')
    at Object. (C:\Users\camer\programs\musicbot\index.js:14:23)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47
    anyone know whats wrong?

    • @SebaSefu
      @SebaSefu Год назад

      Found the solution? I have the same problem

    • @Jogender-jt7kb
      @Jogender-jt7kb Год назад

      NotDevansh#6554

    • @omerbalter9141
      @omerbalter9141 Год назад

      @@SebaSefu I used const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates] }); GatewayIntentBits is imported from discord.js

    • @huski6862
      @huski6862 Год назад

      @@Jogender-jt7kb I Have a same problem, could u help me please?

    • @elblogdejojan5453
      @elblogdejojan5453 Год назад

      you found the solution i have same problem

  • @charminarchaupal
    @charminarchaupal Год назад

    RUclips has blocked all discord bots which is why you will get stream error even when all the code is correct

  • @Im-a-man
    @Im-a-man 2 года назад

    12:35

  • @harshjaiswal9717
    @harshjaiswal9717 Год назад

    how to earn money by free discord bot

  • @31.daanii
    @31.daanii 2 года назад

    I don´t speak Taka Taka bro, sorry.Dislike

    • @WalyMTY
      @WalyMTY 2 года назад +1

      poor ignornate lmao

  • @trigeeeagleye
    @trigeeeagleye Год назад

    node .
    node:internal/modules/cjs/loader:988
    throw err;
    ^
    Error: Cannot find module '/home/runner/Smart-Bot'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
    code: 'MODULE_NOT_FOUND',
    requireStack: []
    }

  • @diwangmittal8067
    @diwangmittal8067 Год назад

    C:\Users\Admin\Downloads\bot\index.js:24
    const filepath = path.join(commandsPath, file);
    ^
    ReferenceError: file is not defined
    at Object. (C:\Users\Admin\Downloads\bot\index.js:24:46)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47
    Node.js v18.17.1
    PS C:\Users\Admin\Downloads\bot>
    how do i fix this

  • @satriogurunej1028
    @satriogurunej1028 6 месяцев назад

    my @discordjs/opus is erorr any1 can fix it?

    • @ahmedali9271
      @ahmedali9271 6 месяцев назад

      did u solve it?

    • @landjaager
      @landjaager 3 месяца назад

      @@ahmedali9271 look my reply

    • @vincentthe1st
      @vincentthe1st 22 дня назад

      @@ahmedali9271 ruclips.net/video/mUQTI6Fk6RQ/видео.html

  • @Girlhead
    @Girlhead Год назад +2

    Just LOVE IT when these horrible videos SKIP STEPS. Thanks.

  • @ryfiction
    @ryfiction Год назад

    What if i want prefix instead of slash commands.

  • @salilfernandes4947
    @salilfernandes4947 Год назад

    TypeError: client.player.createQueue is not a function, any solution to this error?

    • @u4ifficial
      @u4ifficial Год назад

      replace it with client.player.queues.create(interaction.guild)

  • @Zen1thCZ
    @Zen1thCZ 2 года назад

    VS Code problem:' npm' is not recognized as an internal or external command,
    operable program or batch file. how the hack od i fix that?

    • @gazelle1056
      @gazelle1056 2 года назад

      If you don't have node.js installed, that's most likely your problem.
      If you do have node.js installed, and rebooting you computer hasn't fixed the issue, kill the Terminal on VS Code, and start a new one.
      If that hasn't worked, add a semicolon to the end of the Path Variable as below.
      ;C:\Program Files
      odejs\
      You can find that through Computer > Advanced System Settings > Advanced > Environment Variables > click on "PATH" and "Edit"