https://support.cloudways.com/how-to-resolve-wordpress-asking-for-ftp-credentials-error/
The error usually occurs when the following code is missing from your wp-config.php file:
define('FS_METHOD','direct');
This function allows the current user to edit or install files in your folder. Here is how you can remedy this issue.