I have just flashed Raspbian to my 8 GB hard drive, but when I boot up the Raspberry Pi and log in, it says:
bash: startx: command not found
Is there a problem with the boot files?
It sounds like you may have installed the Raspbian lite distribution, which is just command line, and no GUI. If you need a GUI, you could try installing Raspbian Pixel (full OS with GUI) on your SD card.
See this post for more discussion: startx: command not found