Unable to get the info of the user which doesn’t have created any post via REST API

This is by design and within WP_REST_Users_Controller::get_item_permissions_check() we e.g. have a non-zero check with count_user_posts( $user->ID, $types ).

We note that count_user_posts() is filterable with the get_usernumposts filter so one could change 0 to 1, for the /wp/v2/users/\d+ route:

add_filter( 'rest_request_before_callbacks', function( $response, $handler, $request ){

    if ( WP_REST_Server::READABLE !== $request->get_method() ) {
        return $response;
    }

    if ( ! preg_match( '~/wp/v2/users/\d+~', $request->get_route() ) ) {
        return $response;
    }

    add_filter( 'get_usernumposts', function( $count ) {
        return $count > 0 ? $count : 1;
    } );

    return $response;
}, 10, 3 );

but I would rather recommend creating a custom rest route instead of modifying an existing one like this.

tech