Check out example codes for "Couldn't create temporary file to work with". It will help you in understanding the concepts better.

Code Example 1

sudo apt-get clean
sudo mv /var/lib/apt/lists /tmp
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update

Learn ReactJs, React Native from akashmittal.com