Today I had a problem where ng build — prod worked fine but ng build didn’t.
In both cases, there were no build errors but when I launched the website, the angular app didn’t appear. There was nothing in the console.
The problem was the package-lock.json file. The file should auto generate whenever you run npm install but (for whatever reason) it was out of date.
To fix the problem:
- Delete the package-lock.json file
- Delete the node_modules directory
- Run npm install
- Commit changes to git