I have somehow made my website work locally. But whenever I try to upload it to either netlify or heroku I keep getting errors or it simply refuses to load. It's a react app that uses axios to make API calls for crypto prices. Additionally, in the Public folder of the same website ( where index.html for react app is ) I have a webscraping vanilla JS app that pulls stock prices from yahoo.finance and stores in into a CSV ( excel file ). Then I have an async function to display that data into HTML from an excel file.
In order to make the app display data I have to change the start script in package.json to
"start": "react-scripts start",
"server": "node public/index.js",
"build": "concurrently \"npm run server\" \"npm run start\"",
I'm using concurrently because I need to start the react server "npm start" and start the node.js server "node index.js" together so one can display data and one can pull data.
If I do "npm run build" - it works flawlessly.. if I upload the website to netlify or heroku - it' s errors on errors.. Does anybody know how to fix this? I've been battling with it for quite a while :(
UPDATE
Heroku - it starts the node.js server, but doesn't deploy the website (I can see it update the stock prices in my terminal, but error when I check the URL).. it also throws this error
-----> Timed out running buildpack Node.js
Terminated
/tmp/codon/tmp/buildpacks/2cd3309e34d34b154aac9f665b0eb2d2e86d8b8e/lib/monitor.sh: line 1: kill: (3899) - No such process
node:events:504
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:160:15)
at writeGeneric (node:internal/stream_base_commons:151:3)
at Socket._writeGeneric (node:net:795:11)
at Socket._write (node:net:807:8)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at Socket.Writable.write (node:internal/streams/writable:334:10)
at OutputWriter.write (/tmp/build_6f046d26/node_modules/concurrently/dist/src/output-writer.js:60:31)
at SafeSubscriber._next (/tmp/build_6f046d26/node_modules/concurrently/dist/src/concurrently.js:71:77)
at SafeSubscriber.__tryOrUnsub (/tmp/build_6f046d26/node_modules/rxjs/internal/Subscriber.js:205:16)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
! Push failed
For Netlify:
Here's my GITHUB - maybe someone can check it out on their own..