Question

Deploying Nx Angular App errors with bash: nx: command not found

Hello,

I’m currently exploring deploying an Nx based angular app on Digital Oceans App Platform but am getting an error on deployment:

bash: nx: command not found

[2021-04-25T09:32:14.612631910Z] bash: nx: command not found
[2021-04-25T09:32:14.616565055Z] building: exit status 127
[2021-04-25T09:32:14.620799953Z] ERROR: failed to build: exit status 1
[2021-04-25T09:32:21.282199271Z] cut: write error: Broken pipe
[2021-04-25T09:32:29.193501853Z] 
[2021-04-25T09:32:29.193542588Z] For documentation on the buildpacks used to build your app, please see:
[2021-04-25T09:32:29.193563839Z]    Node.js: https://do.co/apps-buildpack-node
[2021-04-25T09:32:29.195310459Z] 
[2021-04-25T09:32:29.195927891Z]  ! Build failed (145)

Originally I was using the following build command:

nx build [nx angular app name] --prod

And then I tried using:

npm i --only=dev && nx build [nx angular app name] --prod


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

you can try npx nx or yarn nx instead of nx

I had the same issue then i ran npx XX XX then it works, may be there is something related to configuration but the below solution works for me know.

use $ npx nx build [nx angular app name] --prod

and do not forget to change the configuration for your angular app in angular.json for the specific app

“serve”: { “options”: { “port”: 8080, “host”: “0.0.0.0” } },