Encountered issues during deployment on Heroku platform using npm and Java

Previously, I had challenges installing a Java module on localhost but managed to resolve it using the steps outlined in this post: https://github.com/nodejs/node/issues/10289. It worked well on localhost, and now I am attempting to deploy my app on Heroku. However, I encountered the same error while deploying, despite setting up the Java Buildpack.

Unfortunately, I have been unable to fix the issue this time around. Any help or guidance will be greatly appreciated!

Here is a snapshot of my package.json:

{
  "name": "tachology",
  "version": "0.0.0",
  "main": "server/index.js",
  "dependencies": {
    ...
  },
  "devDependencies": {
   ...
  },
  "engines": {
    "node": "6.2.2",
    "npm": "3.9.5"
  },
  "scripts": {
    "test": "gulp test",
    "update-webdriver": "node node_modules/protractor/bin/webdriver-manager update",
    "start": "node server"
  },
  "private": true
}

During the deployment process, the following logs were generated:

...
[Logs detailing installation errors]
...

Answer №1

It appears that in order for your node-gyp to be built correctly, it requires the presence of Java. The unique aspect of Heroku's architecture lies in its ability to provide only what is explicitly specified or needed by the user. Currently, Heroku may not recognize the need for a JVM to execute your application. Therefore, you must implement a buildpack, which serves as a guide for Heroku on what to set up, install, and construct. Specifically for utilizing Java Virtual Machine (JVM), there exists a suitable buildpack named heroku/jvm.

Consequently, the necessary action entails adding this buildpack to your application either through the dashboard interface or using the CLI command heroku buildpacks:add heroku/jvm.

An additional step involves organizing the build order for java/jvm since your application demands javac during the build process itself. To achieve this, consider executing the command

heroku buildpacks:add --index 1 heroku/jvm
. By placing the JVM buildpack at position 1, all other buildpacks are shifted down in order.

By following these steps, the app will initiate building by configuring the JVM first, thereby enabling the use of javac within your instance before proceeding with NodeJS build. As a result, the build procedure will utilize the javac from the current environment to compile code accordingly.

For further information, refer to: Mulitple Buildpacks in Heroku

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

Leveraging datatable in node.js applications

I'm attempting to integrate jquery Datatable with Node.js and here is the HTML code snippet I have: <button id="btnSearch" type="submit" class="btn btn-responsive"><i class="icon-search"></i>&nbsp;Search</button> <div ...

What is the most efficient way to locate the next occurrence of a sub-buffer within a larger buffer, especially when you have a specified minimum distance to search

Summary: Although there are existing CSV file reading libraries for Node.js, I decided to create my own function to maximize optimization based on the specific properties of my CSV format. The file contains a variable entry-count-per line structure, which ...

npm is currently unable to fetch packages from the registry at registry.npmjs.org

I am encountering the following error message when trying: npm search rollup npm ERR! pna.nextTick is not a function npm ERR! code ECONNRESET npm ERR! network tunneling socket could not be established, statusCode=503 npm ERR! network This is a problem re ...

Having trouble retrieving the content of a paragraph inside an accordion element using Selenium in Java

After successfully using xpath to retrieve the text from the first paragraph, I encountered issues with getting the text from the second and third paragraphs. The console output showed them as empty. The problematic strings were: String secondAns , String ...

Can anyone help with displaying a PNG image in Vue/Node/Express? I am struggling to show the image that I sent from a Node.js server to a Vue app client

In my Node/Express application, I've set up a route like this: app.get('/get-image', function(req, res) { ... res.sendFile(path.join(__dirname, '..', account.profileImg)); }) Now in my client-side Vue app, I'm tryi ...

Press the OK button on a popup window using Selenium

I'm trying to click on the "OK" button in a modal alert, but for some reason I can't seem to make it work. // Capturing alert message. String alertMessage= driver.findElement(By.className("modal-header")) .getText( ...

I keep encountering the same issue every time I try to execute the npm run watch command. Does anyone have any suggestions on how to fix this?

When attempting to execute the command npm run watch, I encountered an error as shown below: ERROR Failed to compile with 1 errors2:50:28 PM This dependency was not found: * vue in ./resources/js/app.js To install it, you can run: npm install --save vue ...

Exploring dependencies in Node.js with depcheck to uncover instances of require('x') where 'x' is not listed in the package.json file

Recently, I came across a library called depcheck: https://www.npmjs.com/package/depcheck Initially, I assumed that it would solve my problem of finding modules used in the code but not declared in package.json. However, to my disappointment, it only loo ...

Error message: "CORS issue arises in NextJS custom server following execution of 'npm run build'"

Everything was running smoothly until I needed to implement a production build with Server Side Rendering. Unable to utilize "next export," I ran into issues after executing "npm run build." Authentication failures led me to discover that the backend serve ...

Create with API-19 using [email protected]

After installing Cordova using npm, I discovered that the latest version of cordova-android available is 4.1.1. I proceeded to create a project using "cordova create" and added a platform. However, when attempting to build the project, the build process fa ...

Unexpected token caused by the Async keyword in served content in Electron

Currently, I have a functioning node server that hosts a basic monopoly app, with my electron application simply loading the URL of this server. However, I've encountered a problem related to asynchronous functions present in the front-end JavaScript ...

Is it possible for the req.url path in expressjs to represent a different URL?

Recently, I discovered some suspicious requests being sent to my node-express server. In response, I created a middleware to record the request URLs. After logging these requests, I noticed that most of them started with '/', but there were also ...

Issue: ENOENT, unable to locate 'C:UsersAliAppDataRoaming pm'

Upon trying to initialize npm in a fresh Node.js installation, I encountered the following error: Error: ENOENT, stat 'C:\Users\Ali\AppData\Roaming\npm' ...

Leveraging Dust.js LinkedIn templates within a Node.js framework alongside Express 3.x

I am struggling to understand how to implement the dustjs-linkedin templates in express 3.x #app.js var dust = require('dustjs-linkedin'); app.set('view engine', 'dust'); app.get('/test1', routes.test1); # ...

Step-by-step guide on invoking a recursive function asynchronously in JavaScript

As I delved into the realm of creating a unique Omegle clone using Node.js and Socket.io for educational purposes, I encountered a challenge that has left me scratching my head. The socket ID of clients along with their interests are stored in an array of ...

JavaScript heap ran out of memory near heap limit during mark-compacts, rendering the allocation ineffective, resulting in a failed Ionic 3 production build

While attempting to build a production version of my Ionic 3 app, I encountered the following error: "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory". To troubleshoot this issue, I duplicated the en ...

Why is ExpressJS req.user giving back undefined?

Why is the user returning undefined? I am completely lost export const getCurrentUser = async (req, res) => { // fetch user console.log(req.user) const user = await User.findOne({ _id: req.user.userId }) // fetch withdraws res.send({ curre ...

Having trouble sending an email using nodejs and mailgun

Before accusing me of asking a duplicate question, I want to clarify that I have already searched for solutions and none of them worked for me. For example, I tried the solution provided in this link: Example of the domain name for mailgun before nodejs? ...

What are some strategies to keep users from navigating back using the browser after signing up?

Currently, I'm implementing an authentication system in my Node.js application using passport. Everything seems to be working smoothly except for one issue - when I click the back button in the browser, it takes me back to the signup page. This is h ...

Is there a way to transform authorid into postid in order to retrieve author information and store it in my authorDocument array?

**Can you help me troubleshoot why this code is not functioning properly? ** let posts = await postsCollection.aggregate([ {$match: {_id: new ObjectID(id)}}, {$addFields: {authorId: { $toObjectId: "$author"}}}, {$lookup: {from: "user ...