ng build weirdness – package-lock.json

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:

  1. Delete the package-lock.json file
  2. Delete the node_modules directory
  3. Run npm install
  4. Commit changes to git

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.