Restoring Node Modules/Build To Previous State

Get the correct version of package.json AND package-lock.json files. Do not delete these or automatically regenerate the package-lock.json file. Simply use the versions from the working state. Then carry out the following commands.

rm -rf node_modules
npm cache clean --force

if you are using nvm to manage node version, ensure you have the right one selected for your build

source $NVM_DIR/nvm.sh && nvm use 14
npm install

You can now run your usual commands and all should work as expected. Example below.

npm run watch
npm run prod