Fixed event handling to handle case where we delete/rename pubspec.yaml or cache

Fixed #3018

review: @devoncarew