[Solved] Angular build Error: throw er; // Unhandled ‘error’ eventEmitted ‘error’ event on ChildProcess instance

Background description

1. Ng server can start normally (no problem with compilation)

2. Ng build error

Error content (forgot the screenshot, * * * has indicated the intermediate content)

throw er; // Unhandled ‘error’ event
***
Emitted ‘error’ event on ChildProcess instance at:
***
errno: -4058,
code: ‘ENOENT’,
****
spawnargs: [ ‘–service=0.12.9’, ‘–ping’ ]

Solution:

Execute node_ Modules/esbuild/install.js file

node  PATH/node_modules/esbuild/install.js

Build again

Read More: