Question

App Platform Deployment Failing Due To npm Error. Not Sure How To Solve

Recently, my deployments to my node app started to fail. They were successful, then all of a sudden they all started to fail with the same error message found below. I have not changed anything in my app/source code. What could be the problem?

[2022-04-21 05:30:19] => Initializing build
[2022-04-21 05:30:19] => Retrieving source code to /workspace
[2022-04-21 05:30:19] => Selecting branch "master"
[2022-04-21 05:30:20] => Checking out commit "commit"
[2022-04-21 05:30:21] => Got source_dir: /
[2022-04-21 05:30:21] => Using workspace root /workspace
[2022-04-21 05:30:21] 
[2022-04-21 05:30:21] => Building app using buildpacks
[2022-04-21 05:30:21] => Injecting app environment variables:
[2022-04-21 05:30:21]      ENV
[2022-04-21 05:30:21] => Running buildpack detection
[2022-04-21 05:30:21] 
[2022-04-21 05:30:21] 3 of 4 buildpacks participating
[2022-04-21 05:30:21] heroku/nodejs-engine  0.5.0
[2022-04-21 05:30:21] digitalocean/node     0.3.4
[2022-04-21 05:30:21] digitalocean/procfile 0.0.3
[2022-04-21 05:30:21] 
[2022-04-21 05:30:21] For documentation on the buildpacks used to build your app, please see:
[2022-04-21 05:30:21]    Node.js: https://do.co/apps-buildpack-node
[2022-04-21 05:30:22] 
[2022-04-21 05:30:22] => Checking for cache from a previous build
[2022-04-21 05:30:29] Layer cache not found
[2022-04-21 05:30:29] Restoring metadata for "heroku/nodejs-engine:nodejs" from app image
[2022-04-21 05:30:32] Layer cache not found
[2022-04-21 05:30:33] Removing "heroku/nodejs-engine:nodejs", not in cache
[2022-04-21 05:30:33] 
[2022-04-21 05:30:33] => Building app
[2022-04-21 05:30:33] 
[2022-04-21 05:30:33] ---> Node.js Buildpack
[2022-04-21 05:30:33] ---> Installing toolbox
[2022-04-21 05:30:33] ---> - jq
[2022-04-21 05:30:33] ---> - yj
[2022-04-21 05:30:34] ---> Getting Node version
[2022-04-21 05:30:34] ---> Resolving Node version
[2022-04-21 05:30:36] ---> Downloading and extracting Node v18.0.0
[2022-04-21 05:30:52] ---> Parsing package.json
[2022-04-21 05:30:52] ---> No file to start server
[2022-04-21 05:30:52] ---> either use 'docker run' to start container or add index.js or server.js
[2022-04-21 05:30:52] Project contains package-lock.json, using npm
[2022-04-21 05:30:52] unable to invoke layer creator
[2022-04-21 05:30:52] checking installed npm version: checking npm version: exit status 1
[2022-04-21 05:30:52] ERROR: failed to build: exit status 1
[2022-04-21 05:30:54] 
[2022-04-21 05:30:54] For documentation on the buildpacks used to build your app, please see:
[2022-04-21 05:30:54]    Node.js: https://do.co/apps-buildpack-node
[2022-04-21 05:30:54] 
[2022-04-21 05:30:54]  ! Build failed (145)

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
July 14, 2024

Hi there,

Just came across this question here, based on the error log provided, the deployment of your Node.js application is failing based on this specific error message checking installed npm version: checking npm version: exit status 1 and ERROR: failed to build: exit status 1 which suggests that there is a problem with the npm installation or version check.

Specify your desired Node version in the engines section of package.json.

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

You can customize the npm version used by specifying the version in the engines section of your package.json:

{
  "engines": {
    "npm": "~1.0.20"
  }
}

For more information you can check out the documentation here:

https://docs.digitalocean.com/products/app-platform/reference/buildpacks/nodejs/#specifying-versions

- Bobby

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

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

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.