0

This works just fine on my computer, but when I run it on my VPS, it gives me this error. It is weird because it was working earlier.

Here is my file structure: https://prnt.sc/v5rm5a


Error:
0|zenvy  | Error: ENOENT: no such file or directory, scandir './src/commands'
0|zenvy  |     at Object.readdirSync (fs.js:955:3)
0|zenvy  |     at Object.<anonymous> (/home/vicljr/zenvyBot/src/zenvy.js:10:25)
0|zenvy  |     at Module._compile (internal/modules/cjs/loader.js:1137:30)
0|zenvy  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
0|zenvy  |     at Module.load (internal/modules/cjs/loader.js:985:32)
0|zenvy  |     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
0|zenvy  |     at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:32:23)
0|zenvy  |     at Module._compile (internal/modules/cjs/loader.js:1137:30)
0|zenvy  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
0|zenvy  |     at Module.load (internal/modules/cjs/loader.js:985:32) {
0|zenvy  |   errno: -2,
0|zenvy  |   syscall: 'scandir',
0|zenvy  |   code: 'ENOENT',
0|zenvy  |   path: './src/commands'
0|zenvy  | }

My main file (snippet):

const commandFiles = fs.readdirSync('./src/commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}
Victor
  • 3
  • 3

0 Answers0