Heroku App push was unsuccessful due to compilation failure of the Node.js application

I made sure to include node_modules in .gitignore so that's not causing any issues!

Does anyone have a solution for these errors? I've specified versions for both in the engines section.
https://i.stack.imgur.com/tMDOd.png Here is the code :

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  
  "engines": {
    "node":"12.6.2",
    "npm":"6.14.4"
  },
  "scripts": {
    "start": "node index.js"
  },
  "author": "smeet_kothari",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  }
}

and here is my index.js file https://i.stack.imgur.com/f8ypn.png

Check out the code of index.js file below.

const app = express();

app.get('/', (req,res) => {
    res.send({hi:'there'});
});

const PORT = process.env.PORT || 5000;
app.listen(PORT); 
G:\01) Web Development\10) nodejs project\[FreeCourseSite.com] Udemy - Node with React Fullstack Web Development\MailFeed\server>heroku -v
heroku/7.47.7 win32-x64 node-v12.16.2

A Procfile has been added as well! https://i.stack.imgur.com/7Puno.png

Appreciate any solutions you can provide, thank you!

Answer №1

If you haven't set up a Procfile for the project yet, give it a try. If the issue persists, make sure to note down the complete error message displayed in the command line and comment it here.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I'm facing an issue where the React-Nodejs app frontend fails to load when using docker-compose up in my network, however,

My React Node.js application runs fine locally, but when I dockerize it and run docker-compose up, only the localhost page loads, not the network. I'm unsure where my configuration is wrong for the frontend and would appreciate any help! I have separ ...

Using the spread operator in ES6 allows for arguments to be placed in a non-con

When working in nodeJS, my code looks like this: path = 'public/MIN-1234'; path = path.split('/'); return path.join( process.cwd(), ...path); I was expecting to get: c:\CODE\public/MIN-1234 but instead, I got: `‌publ ...

Express API for creating and managing JWT tokens for user authentication

While experimenting with Postman to sign up a new user with the data {"firstName": "John", "lastName":"zoe", "email":"[email protected]", "password":"123465"}, I encounter ...

Testing the performance of MEAN applications under heavy load

As I work on developing an application using the cutting-edge MEAN stack, I have successfully deployed the initial version to a server. This application comprises of a static HTML file (along with CSS and some images) as well as numerous JavaScript files. ...

What is the best way to incorporate a basic middleware that can validate JWT tokens and ensure proper authorization?

I have implemented a middleware for authentication using JWT and passport.js in my project. However, I also need to add a verification step for all controllers to check if the user is an admin. The current passport.js middleware I am using for authenticati ...

What is the process for enabling external host access to a port in a Docker container?

I've been working on exposing a port in my Docker container and attempting to connect an application from an external host, but I'm having trouble establishing a connection. Here is the curl request: curl http://localhost:4400 curl: (56) Recv fa ...

How to ensure folder creation before uploading in Express.js

Is there a way to ensure the creation of a folder before uploading an image to prevent getting an ENOENT error? Here is the code I have been using: module.exports = function(router){ router.post('/result', directory.tmp, uploader.single, f ...

Using NodeJS to Send JSON Data via HTTP POST Request

Issue with Sending JSON Data via Http Post in NodeJS const http = require('http'); const fs = require('fs'); var options = { hostname: 'www.postcatcher.in', port: 80, path: '/catchers/5531b7faacde130300002495&apo ...

Postman's GET Request is stuck and fails to provide any results

I've been working on creating a REST API using Node.js, Express, & MongoDB. So far, everything seems to be functioning properly. The server is up and running, and it successfully connects to the MongoDB database named API, which consists of two collec ...

The functionality of Highcharts-more.js is not functioning properly within a project set up using vue-cli

Recently, I have been working on a vue-cli project and attempting to create a polar chart similar to the one shown here: To achieve this, I needed to install and import the highcharts and highchart-more libraries using npm. However, upon importing both fi ...

Struggling to resolve the unspecified outcome of an await operation

I'm looking to implement password comparison using the Bcrypt library. Here is the code snippet: bcrypt.js const bcrypt = require('bcrypt'); const saltRounds = 10; var Bcrypt = () => { } Bcrypt.encrypt = async function(password) { ...

What is the functionality behind app.listen() and app.get() in Hapi.js, Restify, and Koa?

Using the http node module, which consists of only native modules, how can I create a custom version of app.listen() and app.get() by utilizing the http module with a constructor? var app = function(opts) { this.token= opts.token } app.prototype ...

The container process could not be initiated because the executable file "npm run start" was not found in the $PATH

I've successfully containerized an application, complete with its own Dockerfile: FROM front-end-base:latest COPY ... /app/... ... EXPOSE 5000 RUN cd /app CMD ["npm run start"] The front-end-base image includes Node, NPM, Yarn, and a few ot ...

The Angular project encounters a failure when attempting to run 'ng serve,' resulting in an emitted 'error' event on the worker

Resolved Issue - Update: It appears that the problem was due to an error in my CSS code: Previous: .title & .smaller { color: $dark-blue; font-family: "Roboto"; font-size: 20px; font-weight: 600; width: fit-content; margin: 0; ...

Unable to instantiate the node redis client

I encountered an issue while trying to start my node application, and I received the following error message: TypeError: redisClient.on is not a function The problem seems to be related to the RedisClient module: const redisClient = require('re ...

Encountering issues with connecting to the MongoDB server through Node.js

When working with MongoDB in Python, everything runs smoothly without any errors. However, when using Node.js, an error keeps popping up. Can someone please guide me on how to resolve this issue? jdcaovuwqxoqppwwqmjcawpwuaciwowjqwqhpaiwdoqi Below is the ...

I keep encountering an issue with Nodemailer where it keeps throwing the error message "TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument needs to be a string or.."

The error message is incredibly long, but here is a brief excerpt: TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object at PassThrough.Writable.write ( ...

Sending parameters with a linked Get request leads to a 404 error page

Exploring how to interact with an external API using a TS/Express server. The user will choose a product, triggering a GET request to the server, which then queries the external API for pricing data. This is a project for fun and learning purposes, so ple ...

The npm package installation process encountered difficulties in accessing the Chart.Js library

Currently, I am in the process of developing a web application that tracks and logs hours spent on various skills or activities. The data is then presented to the user through a bar graph created using Chart.js. Initially, I was able to display a mock grap ...

Unable to locate the 'drizzle-orm' package within the Docker Container despite executing npm install in the Dockerfile

I set up all the dependencies in my Dockerfile using npm ci as shown below. Dockerfile FROM node:20-alpine AS base # 1. Install necessary dependencies FROM base AS deps RUN apk add --no-cache libc6-compat WORKDIR /app COPY package.json yarn.lock* packag ...