Project fails to start


#1

My project betabot-rewritten spams EIO i/o errors, checked code is correct. What’s the issue?


#2

Hello, there
Could you send me the error? Would be easy if I could check out what’s exactly you mean.


#3

Yeah sure, error is

Error: EIO: i/o error, read

at Object.fs.readSync (fs.js:614:3)

at tryReadSync (fs.js:454:20)

at Object.fs.readFileSync (fs.js:487:19)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:688:20)

at Module.load (internal/modules/cjs/loader.js:589:32)

at tryModuleLoad (internal/modules/cjs/loader.js:528:12)

at Function.Module._load (internal/modules/cjs/loader.js:520:3)

at Module.require (internal/modules/cjs/loader.js:626:17)

at require (internal/modules/cjs/helpers.js:20:18)

at Object. (/app/node_modules/ws/index.js:3:19)

Error jumps to index.js, code is

const Discord = require('discord.js')
const bot= new Discord.Client();
const cfg = require ('./config.json');

bot.on('ready', () => {
  console.log('Im ready to blast noobs!');
  bot.user.setActivity('Creator is either half asleep or fully sleep.... in tests.| Release 1.2 Private Beta Channel | 4 Guilds'); 
    var channel = bot.channels.get('350776473621364736', '442527207252951052');
    channel.send(`Betabot Restarted oml :eyes:. Version 1.2 r134`)  
});

bot.on ('message', msg => {
  if (msg.author.bot || !msg.content.startsWith(cfg.prefix)) return;
  const args = msg.content.slice(cfg.prefix.length).split(' ')
  const command = args.shift().toLowerCase()
  if (command === 'ping') {
    const then = Date.now();
    msg.channel.send('Pinging...').then(m => {
        m.edit(`Pong! It took ${Date.now() - then}ms to send that message!\nDiscord Heartbeat:${bot.ping}`);
    });
  }
if (command === 'ban') {
  if (!msg.member.permissions.has("KICK_MEMBERS")) return msg.reply('You try and weild the BANHAMMER TM, but you are too weak to be able... Technical details: User missing permission KICK_MEMBERS');
  const member = msg.mentions.members.first();
  if (!member) return msg.reply('Invalid usage, please try `&kick @user#1234  `');
  if (!member.bannable) return msg.reply('uf too powerful');
  member.ban({
    reason: `Banhammer falls by ${msg.author.tag}`
  });
  msg.channel.send ('**K, I rekt that user :ok_hand:**')
}
  if (command === 'kick') {
    if (!msg.member.permissions.has("KICK_MEMBERS")) return msg.reply('You try and weild the BANHAMMER TM, but you are too weak to be able... Technical details: User missing permission KICK_MEMBERS');
  const member = msg.mentions.members.first();
  if (!member) return msg.reply('Invalid usage, please try `&kick @user#1234  `') 
  if (!member.kickable) return msg.reply('uf too powerful (Requested member is higher than you (in ranks) )');
  member.ban({
    reason: `Banhammer falls by ${msg.author.tag}`
  });
  }
  if (command === 'help') {
    msg.reply('DMed instructions!!')
    msg.author.sendMessage("HERE ARE THE CURRENT COMMANDS: ban: Bans an user. (ID bans coming soon) kick: Kicks an member. mute: Broken atm, fixing soon. Ping: Finds the bot's MS and HeartBeat times. Any issues should be adressed here: https://github.com/boomt1337/betabot .")
  }
  if (command === 'reportabug') {
      msg.channel.send('to report bugs, please go on this GitHub issue: https://github.com/boomt1337/betabot/issues/1. To see what is being fixed, go to the Projects tab.')
  }
  if (command == 'botinfo') {
 
  msg.channel.send({embed: {
    color: 3447003,
    author: {
      name: bot.user.username,
      icon_url: bot.user.avatarURL
    },
    title: "BETABOT",
    url: 'https://github.com/boomt1337/betabot',
    description: "An bot made by an newbie, hence the name 'betabot.'",
    fields: [{
        name: "Bot Commander",
        value: "boomt1337#3590"
      },
      {
        name: "Invite link",
        value: "https://discordapp.com/api/oauth2/authorize?client_id=403406484115030018&permissions=8&scope=bot"
      },
      {
        name: "Special thanks",
        value: "Friends: khuza#5599 (IRL), Savanna#8525, Chriskc2#7847, ひでのり#7193. Coding happened with thanks to: An Idiots Guide, TheSourceCode, Avicii (RIP), codecadamy."
      }
    ],
    timestamp: new Date(),
    footer: {
      icon_url: bot.user.avatarURL,
      text: "© boomt1337 2018."
    }
  }
});
    
}
  if (command === 'randomnumber') {
    msg.channel.send(Math.random) / 100
  }
  if (command === 'restartbot') {
  msg.channel.send('HA, you cant restart me! anyways my commander can please dm gone#3214')
  }
  if (command === 'work') {
    msg.channel.send('You typed work command... have' + Math.random() / Math.random() )
  }
  if (command === 'support') {
    msg.channel.send('Join support server to call the owner a lazy ass... wait pls dont he will be mad >:( https://discord.gg/bDVtF4Z')
  }
  if (command === '8ball') {
  var replies = ["Yeas!", "Hell no!", "Hmm, can't think atm. Try again.", "Maybe?", "Probably not."]
 var result = Math.floor((Math.random() * replies.length) + 0);
    
   const embed = new Discord.RichEmbed()
   .setTitle('Results!')
   .addField(args, replies[result])
   msg.channel.send({embed: embed})
  }
});
const http = require ('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
  console.log("HI! I am still alive");
  response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);    
  
bot.login(cfg.token);

#4

Ah, node version too new for npm. Resolved


#5

Change engine field to 10.x not 10.0.1 or whatever


#6

Hi,

I am experiencing the same issue. How do I go about fixing this?

Thanks


#7

In the above case, it was apparently caused by the node version being too new for npm, which you can fix by changing the npm or node version in the engines field in your package.json file.

If you have trouble, let us know the project name and we’ll take a look. If your project is private, either make it public temporarily or DM me a join link so we can view the code. Thanks.