Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

368
Views
Reemplazando main.js con index.js, Error: ENOENT?

Estoy confundido acerca de por qué funciona este bot ahora, creo que es porque no tengo un "index.js". Uso "main.js". ¿Cómo puedo cambiar de "main.js" a "index. js"?

Agregaré todos los códigos principales que pueden ayudarlo a detectar un error: D

Aquí está el código en "main.js":

 const { Client, Collection, Intents } = require('discord.js'); const client = new Client({ disableMentions: 'everyone', partials: ['MESSAGE', 'CHANNEL', 'REACTION'], ws: { intents: Intents.ALL } }); client.commands = new Collection(); client.aliases = new Collection(); ['command', 'event'].forEach(handler => { require(`./handlers/${handler}`)(client); }); client.login(process.env.BOT_TOKEN);

Error:

 internal/fs/utils.js:269 throw err; ^ Error: ENOENT: no such file or directory, open '/home/runner/DwaCraft-Ticket-bot/index.js' at Object.openSync (fs.js:462:3) at Object.readFileSync (fs.js:364:35) at Object.<anonymous> (/run_dir/interp.js:195:19) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 { errno: -2, syscall: 'open', code: 'ENOENT', path: '/home/runner/DwaCraft-Ticket-bot/index.js' } repl process died unexpectedly: exit status 1 

Paquete.json:

 { "name": "ticket-bot", "version": "1.0.0", "description": "A simple ticket bot", "main": "main.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "node main.js" }, "author": "hamoodi", "license": "ISC", "dependencies": { "better": "^0.1.0", "cpu-stat": "^2.0.1", "discord.js": "^12.5.3", "dotenv": "^8.6.0", "express": "^4.17.1", "moment": "^2.29.1", "os": "^0.1.2", "sourcebin_js": "0.0.3-ignore" } }

Archivos:

https://i.stack.imgur.com/FptiD.png

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Como se indica a continuación, puede crear un archivo .replit, y dentro de él poner

ejecutar="nodo [archivo].js"

y reemplace [archivo] a main.

https://replit.com/talk/ask/Is-it-possible-to-changedeleted-indexjs/43264

about 4 years ago · Juan Pablo Isaza Report

0

Cambie el nombre del archivo de main.js a index.js en "scripts" => "start" en el archivo package.json y npm start . ¡Recuerde ejecutar el script desde la folder donde se encuentra el archivo main.js y cambiar el nombre de los archivos !

 { "name": "ticket-bot", "version": "1.0.0", "description": "A simple ticket bot", "main": "main.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "node index.js" }, "author": "hamoodi", "license": "ISC", "dependencies": { "better": "^0.1.0", "cpu-stat": "^2.0.1", "discord.js": "^12.5.3", "dotenv": "^8.6.0", "express": "^4.17.1", "moment": "^2.29.1", "os": "^0.1.2", "sourcebin_js": "0.0.3-ignore" } }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!