The problem behind the laravel installation in ubuntu 18.04
[ErrorException]
file_put_contents(./composer.json): failed to open stream: Permission denied
As the error specify you do not have permission.
To resolve this error execute this command
sudo chown -R $USER ~/.composer
You may also need to remove the .composer
file from the current directory, to do this open up a terminal window and type this command
sudo rm -rf .composer
OR
If that does not work then try to change the permission of composer.lock
file
sudo chown -R $USER composer.lock
OR
Check the directory you are working in