ENOTEMPTY: directory not empty React Native Error Fix

By Rashid •  July 17th, 2019 • 

When I was trying to add a third party library to my react native project using npm the following error was shown in the terminal.

npm ERR! ENOTEMPTY: directory not empty, rmdir ‘/media/rashid/B0305F9E305F6A7C/MyProject/node_modules/.react-native.DELETE/scripts’

As given in the error message it is saying node_modules/.react-native.DELETE/scripts folder is not empty. Hence I navigated to node modules but I didn’t find a folder named .react-native.DELETE there. My OS is Ubuntu, so I pressed ctrl+H to show hidden folders.

There I found the folder named .react-native.DELETE which was hidden earlier. Inside it, there’s another folder named scripts. I emptied the scripts folder by deleting its content. Then I rebuilt the project using command react-native run-android and the error had gone somewhere else!

I hope this react native error fix will help you too!


Keep Reading