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

266
Views
No puedo reparar el error Heroku "No se pudo encontrar un archivo requerido, Nombre: index.html"

Soy nuevo en Heroku. Intenté eliminar .gitignore y reorganizar mis archivos, pero todavía me da ese error. Tengo un programa con React.js como front-end y Node.js como back-end. Necesito esto para implementar en Heroku. La siguiente imagen muestra el error que obtengo.

imagen del error que me sale

En mi código Node.js, intenté especificar dónde debería Heroku en la carpeta "cliente" para el archivo "index.html". Este es mi código node.js:

 //code based off of: // https://medium.com/@dtkatz/3-ways-to-fix-the-cors-error-and-how-access-control-allow-origin-works-d97d55946d9 const express = require('express'); const request = require('request'); const app = express(); const apiKey = 'api-key-here'; // Have Node serve the files for our built React app app.use(express.static(path.resolve(__dirname, '../client/build'))); app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); next(); }); app.get('/getCoinInfo', (req, res) => { console.log('The request has been received!!') request( { url: 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=' + apiKey}, (error, response, body) => { if (error || response.statusCode !== 200) { return res.status(500).json({ type: 'error', message: err.message }); } res.json(JSON.parse(body)); } ) }); // All other GET requests not handled before will return our React app app.get('*', (req, res) => { res.sendFile(path.resolve(__dirname, '../client/build', 'index.html')); }); const PORT = process.env.PORT || 3000; app.listen(PORT, () => console.log(`listening on ${PORT}`));

También aquí está mi estructura de archivos.

ingrese la descripción de la imagen aquí

¿Cuáles son sus sugerencias para solucionar este problema?

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

0

Su archivo index.html parece estar en client/public , no en client/build .

Pero si hay otro index.html en la build , puede intentar usar join en lugar de resolve :

 app.use(express.static(path.join(__dirname, 'client', 'build')));
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!