Report this

What is the reason for this report?

Resolving Node version error.

Posted on December 5, 2022

Hello I was pretty sure I’ve post this question already, but I can’t find it. Sorry if it’s a duplicate. I’m trying to deploy nodejs app from github but I keep getting following ERROR: failed to build: exit status 1. The full log looks as follows:

[2022-12-05 18:30:28] ╭──────────── buildpack detection ───────────╼
[2022-12-05 18:30:28] │ Detected the following buildpacks suitable to build your app:
[2022-12-05 18:30:28] │ 
[2022-12-05 18:30:28] │    heroku/nodejs-engine   v0.5.1  
[2022-12-05 18:30:28] │    digitalocean/node      v0.3.4  (Node.js)
[2022-12-05 18:30:28] │    digitalocean/procfile  v0.0.3  (Procfile)
[2022-12-05 18:30:28] │    digitalocean/custom    v0.1.1  (Custom Build Command)
[2022-12-05 18:30:28] │ 
[2022-12-05 18:30:28] │ For documentation on the buildpacks used to build your app, please see:
[2022-12-05 18:30:28] │ 
[2022-12-05 18:30:28] │    Node.js  v0.3.4  https://do.co/apps-buildpack-node
[2022-12-05 18:30:28] ╰─────────────────────────────────────────────╼
[2022-12-05 18:30:28] 
[2022-12-05 18:30:28] ╭──────────── app build ───────────╼
[2022-12-05 18:30:28] │ ---> Node.js Buildpack
[2022-12-05 18:30:28] │ ---> Installing toolbox
[2022-12-05 18:30:28] │ ---> - jq
[2022-12-05 18:30:29] │ ---> - yj
[2022-12-05 18:30:29] │ ---> Getting Node version
[2022-12-05 18:30:29] │ ---> Resolving Node version
[2022-12-05 18:30:30] │ ERROR: failed to build: exit status 1
[2022-12-05 18:30:30] │ 
[2022-12-05 18:30:30] │ 
[2022-12-05 18:30:30] │ For documentation on the buildpacks used to build your app, please see:
[2022-12-05 18:30:30] │ 
[2022-12-05 18:30:30] │    Node.js  v0.3.4  https://do.co/apps-buildpack-node
[2022-12-05 18:30:30] │ 
[2022-12-05 18:30:30] │  ✘ build failed

In the package.json I have following declarations:

  "version":"0.0.0",
  "engines": {
    "node": "^18.6.0",
    "npm": "^8.14.0"
  },

I can’t figure out what is the reason. The code works when run locally and also works when deployed to Heroku server. The App Spec is as follows:

databases:
- engine: PG
  name: kbdb
  num_nodes: 1
  size: professional-xs
  version: "12"
envs:
- key: LOCAL_BASE_URL
  scope: RUN_AND_BUILD_TIME
  value: ${APP_URL}
name: kboards-staging
region: fra
services:
- build_command: npm run build
  environment_slug: node-js
  envs:
  - key: DATABASE_URL
    scope: RUN_TIME
    value: ${kbdb.DATABASE_URL}
  - key: KBOARDS_APP_KEY
    scope: RUN_AND_BUILD_TIME
    value: kBoards-staging
  github:
    branch: master
    repo: zpiecuch81/kBoards
  http_port: 8080
  instance_count: 1
  instance_size_slug: professional-s
  name: kboards
  routes:
  - path: /
  run_command: npm start
  source_dir: /

Any idea what might be wrong?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

It looks like a problem with the Node.js version that you are trying to use, I could suggest trying with the following instead:

{
  "engines": {
    "node": "18.x"
  }
}

Let me know how it goes!

If this still fails, is your project open-source? If so can you share a link here so I could try the deployment process on my end for further troubleshooting?

As a side note, no worries about the duplicate questions, I will go ahead and delist them.

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.