Question

NetsJS not found during App Platform build

We have a NestJS based backend using the App Platform.

Deployments were working fine until today, where we got the following error during build:

[2024-01-10 14:23:15] │ Running custom build command: yarn build
[2024-01-10 14:23:15] │ yarn run v1.22.21
[2024-01-10 14:23:15] │ $ rimraf dist
[2024-01-10 14:23:17] │ $ nest build
[2024-01-10 14:23:17] │ /bin/sh: 1: nest: not found
[2024-01-10 14:23:17] │ error Command failed with exit code 127.
[2024-01-10 14:23:17] │ info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[2024-01-10 14:23:17] │ building: exit status 127
[2024-01-10 14:23:17] │ ERROR: failed to build: exit status 1

What have been changed / what should we change? (Force deployment with clean caches have not worked)

It’s really puzzling since we have a quite identical “test” environment where everything works fine, even after this error occurred, with forced rebuild & clean caches as well.

I have read somewhere that the “@nestjs/cli” would not work as “devDependency” but as a regular “dependency” (and this sound as a plausible reason), but why have not occurred then this error way before?

Any hint / help is really appreciated :) Gabor


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.

Accepted Answer

For anyone interested: it really sees that somehow DO build/deployment started working differently out of the blue.

As far as we concluded, earlier our app was able to use/access the devDependencies and since this was no more the case, we had to make some dependency/configuration/command changes and were able to make it work.

An useful article how to access devDependencies during the build : https://docs.digitalocean.com/products/app-platform/reference/buildpacks/nodejs/#specifying-devdependencies

Thanks for sharing your solution, @gaborrendes! In my case I found the cause of error suddenly appearing was adding the NODE_ENV environmental variable with value production. Without this, the development dependencies are installed just fine and the nest build command runs.

Try DigitalOcean for free

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

Sign up

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.