Upload Button in meta box not opening library

You mentioned that you’ve added the meta box for pages:

I have created a custom template, added two metaboxes in Pages using a
‘Page_Fiche_Metier.php’ template.

However, in prfx_image_enqueue(), the code only runs if the post type is post. Changing prfx_image_enqueue() so that it checks for the page post type will fix the issue.

function prfx_image_enqueue() {
    global $typenow;
    if ( $typenow == 'page' ) {
        wp_enqueue_media();

        // Registers and enqueues the required javascript.
        wp_register_script( 'meta-box-image', plugin_dir_url( __FILE__ ) . 'meta-box-image.js', array( 'jquery' ) );
        wp_localize_script( 'meta-box-image', 'meta_image',
                array(
                        'title' => __( 'Choose or Upload an Image', 'prfx-textdomain' ),
                        'button' => __( 'Use this image', 'prfx-textdomain' ),
                )
        );
        wp_enqueue_script( 'meta-box-image' );
    }
}
add_action( 'admin_enqueue_scripts', 'prfx_image_enqueue' );