Composer global require laravel/installer" stuck on "Changed current directory"

I am having an issue setting up Laravel on my new machine. When I run the command composer global require laravel/installer, the installation gets stuck on the message Changed current directory to C:/Users/sheer/AppData/Roaming/Composer and does not complete after waiting for an hour.

composer global require laravel/installer

Try running the following command instead:

composer create-project --prefer-dist laravel/laravel project-name

This will create a new Laravel project in a directory called project-name. You can replace project-name with any name you want for your project.