0

I tried to push my recent code to Heroku. Here is what I got in the console:

Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 8 threads
Compressing objects: 100% (26/26), done.
Writing objects: 100% (32/32), 2.90 KiB | 593.00 KiB/s, done.
Total 32 (delta 12), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  16.14.0
remote:        engines.npm (package.json):   8.3.1
remote:
remote:        Resolving node version 16.14.0...
remote:        Downloading and installing node 16.14.0...
remote:        npm 8.3.1 already installed with node
remote:        
remote: -----> Restoring cache
remote:        Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote:        Module installation may take longer for this build
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules
remote:        
remote:        added 1403 packages, and audited 1404 packages in 28s
remote:
remote:        175 packages are looking for funding
remote:          run `npm fund` for details
remote:
remote:        8 vulnerabilities (6 moderate, 2 high)
remote:
remote:        To address issues that do not require attention, run:
remote:          npm audit fix
remote:
remote:        To address all issues (including breaking changes), run:
remote:          npm audit fix --force
remote:
remote:        Run `npm audit` for details.
remote:        
remote: -----> Build
remote:        Running build
remote:        
remote:        > chatapp-project@0.1.0 build
remote:        > react-scripts build
remote:
remote:        Could not find a required file.
remote:          Name: index.js
remote:          Searched in: /tmp/build_1ff4f4ff/src
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to chatapp-project-kasper.
remote:
To https://git.heroku.com/chatapp-project-kasper.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/chatapp-project-kasper.git'

It seems it is searching for a file somewhere. This is my folder structure: https://i.stack.imgur.com/fISfz.png

I am unsure where this file is, or how I can change where heroku searches for the file. Also, in my Procfile I have this:

web: node src/App.js

Any help would be greatly appreciated.

torek
  • 448,244
  • 59
  • 642
  • 775
Kasper04
  • 23
  • 1
  • 3
  • I would like to add that I have submitted a ticket on their site and have not gotten an answer yet. I also have gone to their website for common troubleshooting methods for node apps. – Kasper04 Apr 21 '22 at 10:34
  • The problem isn't _where_ Heroku looks for files. Your file is named incorrectly (or your configuration is wrong): `index.js` ≠ `Index.js`. I don't know enough about React to say what the right solution is, but I suspect renaming `Index.js` to `index.js` will help you move forward. – ChrisGPT was on strike Apr 21 '22 at 11:03
  • Hi @Chris. I have tried to rename the file to index.js when I do git add But it returns to uppercase after i commit and push. Is there a way to stop this from happening? – Kasper04 Apr 21 '22 at 12:38
  • Just doing `git add index.js` won't do it, assuming you're on Windows. [You'll need to `git mv Index.js index.js`](https://stackoverflow.com/a/24979063/354577), then commit. – ChrisGPT was on strike Apr 21 '22 at 12:53

0 Answers0