Error on build in Heroku -pre-received hook declined but why? - node.js

I'm a newbie to deployment and having lots of issues and could really use some guidance! I have an app with the folder structure shown below.
When I started the deployment, I got the backend part to deploy. Screenshot attached
I did a npm build in my client folder and have the following added to the script in my backend package.json
However, when I try to then deal with including the client side, I have a problem and am getting this error.
I was following a tutorial that had a similar folder structure and deployed via
git subtree push --prefix backend heroku master
I also tried 'main' based on answers on stack overflow but it didn't change the error. I am the only one doing anything with this repository (and it's currently private), have no other branches, and I have nothing that hasn't been pushed to my repository in Github (no changes made recently) so I'm not sure what this is about. Any ideas???

I think your folder structure could be the error.
Try something like that:
projectName:
-client
-package.json
-.env
-index.js
with your project structure, Heroku can't read the index.js and the package.json. Because it is nested in your backend folder.
I think this is why you are getting this error:
Error: Cannot find module '/app/backend/server.js'

Related

index.html not found while deploying MERN app to render.com

I was trying to deploy my MERN based E-commerce website on render.com, after the render terminal shows the build was successful the the webpage shows the error as,
{“message”:“ENOENT: no such file or directory, stat ‘/opt/render/project/src/frontend/build/index.html’”,“stack”:null}
I’m a complete beginner to render and MERN too,
I have no bulid folder in my local
then I tried to create another test app by npx create-react-app test to check if build folder is actually present in there or not, But it is not there, I’m totally in Confused now…
I’m Giving my repo here → stunning spark
I just want to have clear answers for my questions(Please!!!)
Things I want to change in my directory to deploy and host my app Successfully.
Things Need to be configured in the render’s settings
Thanks in Advance!!!
I just want to deploy and host my application on render.com
Just run npm run build into your frontend folder and do check you have removed the "build" keyword from the .gitignore file because it won't let you push the build folder to GitHub and you are good to go.

Heroku Deployment failing to see Angular components

I tried to deploy my Angular application trough my gitlab pipeline to heroku. But when i check the logs it seems to error on alot of angular components/modules. This is weird because it doesn't show any errors when i try to build the application local.
Here's the link for the console error:
https://pastebin.com/LnncztUu
gitlab logging
I already tried deleting the node_modules folder and reinstalling it but to my suprise it didn't work. And i compiled my angular application in production mode and i found no errors also.
Are you positive the missing components are fully under source control and were added to the repository. Seems like the components in your own project are missing src/app/Shared/Services/Product.service Not found.

Vue.js Heroku deploy not working

I'm trying to deploy a Vue.js application I made to Heroku, but I keep getting Cannot find module '/app/index.js'.
I feel like I'm just missing something small. Here is the git repo if you are wanting to look through the code. https://github.com/Relofr/calculator
You need app.js (as an example) file in your main directory with basic server configuration. You also have to run npm run build before deploying your app.
Follow this tutorial:
https://medium.com/netscape/deploying-a-vue-js-2-x-app-to-heroku-in-5-steps-tutorial-a69845ace489
You don´t have any file with the name index.js try to rename ./src/main.js to ./src/index.js

I set the heroku node.js buildpack, but the prompt still says push rejected coz failed to detect set

I want to deploy a node.js application onto the heroku through github, and I followed the instructions on heroku. but I stuck on the issue which says the push rejected because of the buildpacks are not set,however I did set the nodejs buildpack, I am a noob, I don't know what the problem it is.someone says package.json should contain engine:node version, is that the reason? because I have put the front-end folder and back-end folder separately. so what should the folder structure looks like?
heroku cli capture

Pushing custom node_module while deploying on heroku

I am trying to deploy my node-express website on heroku. Everything works fine, but just one problem.
I have used express-stormpath as a dependency in my project, which i have customized(the views only).
When I deploy this to heroku, using git push heroku master, the node_module is ignored while uploading and all the modules are installed by heroku itself using npm. So my customization to the node module is not reflected at heroku.
I have tried this also: npm install private github repositories by dependency in package.json
Any suggestions on how to upload whole project including the node_modules to heroku?
If you're using express-stormpath, you should not be customizing the views inside of node_modules -- this is the wrong way to do it. Instead you should be putting your custom views inside of your own 'views' folder, and telling express-stormpath where that file is.
Here's an example of a custom login view, for instance:
app.use(stormpath.init(app, {
loginView: __dirname + '/views/login.jade',
// ...
}));
If you take a look at the express-stormpath docs here: https://docs.stormpath.com/nodejs/express/product.html#update-template-paths (it shows you how to do this).
NOTE: I'm the author of express-stormpath and I randomly saw this question ^^ Hope this was helpful!

Resources