All I had to do was to delete the node_module and package-lock.json file and run npm install again. It build alright when I next ran npm build command
npm install
npm build