Question

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

Posted April 25, 2021 286 views
AngularDigitalOcean App Platform

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

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.

×
Submit an Answer
1 answer

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”
}
},