The prompt for SFTP and FTP details means that you don’t have the right permissions to download or upgrade plugins or the WordPress core.
The most probable reason is that the ownership of your local files is incorrect, but it’s also potentially a permissions issue.
The owner of the files in your project needs to be the Apache user. The easiest way to find out your Apache user is to run this command while the service is running.
Some common users are www or www-data. So now let’s update your project root. Let’s say it is /var/www/projectName and that our Apache user turned out to be www-data:
Now you can attempt the upgrade or install again. More than likely you are up and running, but if not let’s reset file permissions.
Since you are on your local there is no security risk here. Just make sure you don’t pass these permissions on to the live site when you deploy.
In some limited hosting environments, you will also get this prompt on your live site. There isn’t a lot you can do here except get a better host, or deal with a slight inconvenience.