Question

Resolving Node version error.

Hello I’m trying to run webapp and I’m getting hit with Resolving Node version error. The build log looks like follows:

[2022-12-05 11:33:07]  › configuring custom build command to be run at the end of the build:
[2022-12-05 11:33:07]    │ npm run build
[2022-12-05 11:33:07] 
[2022-12-05 11:33:07] ╭──────────── buildpack detection ───────────╼
[2022-12-05 11:33:08] │ Detected the following buildpacks suitable to build your app:
[2022-12-05 11:33:08] │ 
[2022-12-05 11:33:08] │    heroku/nodejs-engine   v0.5.1  
[2022-12-05 11:33:08] │    digitalocean/node      v0.3.4  (Node.js)
[2022-12-05 11:33:08] │    digitalocean/procfile  v0.0.3  (Procfile)
[2022-12-05 11:33:08] │    digitalocean/custom    v0.1.1  (Custom Build Command)
[2022-12-05 11:33:08] │ 
[2022-12-05 11:33:08] │ For documentation on the buildpacks used to build your app, please see:
[2022-12-05 11:33:08] │ 
[2022-12-05 11:33:08] │    Node.js  v0.3.4  https://do.co/apps-buildpack-node
[2022-12-05 11:33:08] ╰─────────────────────────────────────────────╼
[2022-12-05 11:33:08] 
[2022-12-05 11:33:08] ╭──────────── app build ───────────╼
[2022-12-05 11:33:09] │ ---> Node.js Buildpack
[2022-12-05 11:33:09] │ ---> Installing toolbox
[2022-12-05 11:33:09] │ ---> - jq
[2022-12-05 11:33:09] │ ---> - yj
[2022-12-05 11:33:09] │ ---> Getting Node version
[2022-12-05 11:33:09] │ ---> Resolving Node version
[2022-12-05 11:33:10] │ ERROR: failed to build: exit status 1
[2022-12-05 11:33:11] │ 
[2022-12-05 11:33:11] │ 
[2022-12-05 11:33:11] │ For documentation on the buildpacks used to build your app, please see:
[2022-12-05 11:33:11] │ 
[2022-12-05 11:33:11] │    Node.js  v0.3.4  https://do.co/apps-buildpack-node
[2022-12-05 11:33:11] │ 
[2022-12-05 11:33:11] │  ✘ build failed

In the package.json file I have following declaration:

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

The code work when I run the commands locally and also work properly on heroku server. I can’t figure out why it fails here.

Any idea anyone?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
December 6, 2022

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?

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.