how to fix loading scripts in child theme?

You are using a child theme here, it means that you should use get_stylesheet_directory_uri() to get the child theme’s directory.

So, in your case, get_stylesheet_directory_uri() will return:

localhost:8888/wp-content/themes/x-child/

and get_template_directory_uri() will return:

localhost:8888/wp-content/themes/x/

Use this to build your paths. Also, pay attention that you need to include a forward slash before your style/script’s name, since these functions do not provide a trailing slash:

wp_enqueue_style( 'main', get_template_directory_uri() . '/main.css' );

Which will return:

localhost:8888/wp-content/themes/x/main.css