I get this error when trying to do the production packaging, I already tried on another machine and I was able to do it without problems with the same repository, I already uninstalled everything and reinstalled it, I tried several versions of node, npm and angular and I still don't know why happens. The package.json is in the root folder and everything is as it was on the other computer that ran it. I don't understand what happened. It is worth mentioning that the ng serve runs for me without problems.
The structure of my project is as follows...
I get the following error when doing the ng build --configuratioon=prod and if I have the production environment in my angular.json
Now with the npm run build --prod I generate the compile without problems, thank you very much for the help.
You can just run :
npm run build --prod
oIn the package.json in the scripts part you can create a new command like this:
build-prod
When you go to compile you put:
npm run build-prod
if you don't want to add the configuration you can run aloneng build --configuration=production
. This will work for you if you have a production environment file and it is registered in your angular.json like this: