App Build [module] Not Found Errors

I am trying to build and deploy my NestJs server app DO “App” platform linking it to it’s github repository.

As any other NestJs app it has these scripts

"prebuild": "rimraf dist",
"build": "nest build",

Everything was working fine and deployment was successful at first, until suddenly it started failing in the building process giving me the following error.

sh: 1: rimraf: not found

Although I didn’t make any changes to package.json installing, removing or updating any package. Add to that the rimraf package is already included as a DevDependency.

And even when I change the prebuild script to rm -rf dist instead of rimraf dist which I don’t prefer. It gives me another error during the build

sh: 1: nest: not found

How come nest itself is not found. It’s a NestJs app ??

And BTW everything is working perfectly on local machine, and I am not using docker with that project

I also tried to force rebuild and deploy, and even destroyed the whole app and created it from scratch once again … same errors

I don’t understand why that started happening? and how can I fix that?

wish you can help. Thanks

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
January 12, 2024

Hi there,

The issues you’re encountering during the build and deployment process on DigitalOcean’s App Platform seem to be related to the environment’s handling of your application’s dependencies, particularly rimraf and the nest CLI.

These errors often occur when dependencies are not installed or not available in the PATH of the build environment. Here are some steps to troubleshoot and resolve these issues:

  • Ensure that rimraf and @nestjs/cli are correctly listed under devDependencies in your package.json. The App Platform build environment installs packages listed in devDependencies during the build process.

  • The build environment should correctly recognize your application as a Node.js app. Ensure your package.json is correctly configured and is in the root of your repository.

  • Leverage NPM scripts to handle the build process. Modify your package.json scripts to explicitly use local node_modules binaries:

    "scripts": {
      "prebuild": "./node_modules/.bin/rimraf dist",
      "build": "./node_modules/.bin/nest build",
      // other scripts...
  • If the issue persists, consider using a custom build command in your DigitalOcean App Platform settings:

    npm install && npm run build

As a last resort, consider containerizing your application using Docker. This will allow you to define the environment in which your app builds and runs, making it more consistent across local and production environments. You mentioned not using Docker, but it can sometimes offer more control over the deployment process.

Also if your project is open-source, feel free to share the link to your GitHub repository here and I can try deploying it on my and and further investigate the issue.



Try DigitalOcean for free

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

Sign up

Featured on Community

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