App platform looks like it's caching package-lock.json

We are encountering an issue where it seems like the DigitalOcean App Platform app is caching the package-lock.json. We had a working deployment, but after a modification, it broke. Even after reverting the modification, the deployments continued to fail. A forced rebuild and deployment did not help either.

The error:

[2024-03-28 21:23:13] │ > Portaal@1.0.1 copyfiles
[2024-03-28 21:23:13] │ > copyfiles -u 1 "src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}" dist/
[2024-03-28 21:23:13] │ 
[2024-03-28 21:23:13] │ sh: 1: copyfiles: not found
[2024-03-28 21:23:13] │ building: exit status 127
[2024-03-28 21:23:13] │ ERROR: failed to build: exit status 1

Copyfiles is part of package.json and works locally.

We then created a second app and linked it to the same repository with the same settings, and this one works flawlessly! What stands out is that the broken app downloads fewer packages than the new one. It seems like a file is persistently cached.

Logfile broken app:

[2024-03-28 21:22:51] │ added 1023 packages, and audited 1024 packages in 1m

Logfile working app:

[2024-03-28 21:19:05] │ added 1076 packages, and audited 1077 packages in 25s

What we’ve tried:

  • Forced rebuild
  • Used a different Node and NPM version
  • Deleted node modules in a local environment and regenerated package-lock.json. All without result.
  • npm cache clear --force && npm install --only=dev && npm run build && npm prune --production command added to broken app

Edit: Looks like a found a fix. The solution can be foundhere:

Added environment variable:


But the question remains: why does one app work while the other app requires this variable, even though they both use the same codebase and settings?

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

Try DigitalOcean for free

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

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

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

Become a contributor

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

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