Reputation: 15054
I have developed a node.js
application and it is working fine locally.
Now, after that I deployed the application in Heroku
I am getting some HTTP 404 errors
in the browser console.
My understanding is that the reason for this issue is caused by the node package.json
modules. In fact, the outer package.json
is installed successfully but the node modules mentioned in the client folder is not installed.
Q: Any idea about what is necessary to modify (or to do) to make the client node modules as installed?
The image below depicts my folder structure.
Upvotes: 1
Views: 378
Reputation: 33824
Each time you push your code to Heroku, Heroku will look for the package.json
file in the ROOT of your project. Heroku will then install those dependencies.
In your case, because you have multiple package.json
files, Heroku isn't seeing the ones nested in sub-folders of your project.
The best option you have is to list all dependencies in your top-level package.json
file. You could also create your own Heroku Buildpack to customize the Heroku deployment procedure, but I strongly recommend AGAINST doing this (it will be a nightmare to maintain over time).
Another option in your case (which might be good depending on how large your team is) would be to move your client-side code into it's own Git project, and have that deployed separately to a static hosting provider like Amazon S3, or something similar. This would then let you deploy your backend project directly to Heroku, while not having to worry about any front-end logic at all.
Upvotes: 1