Some solutions are given here: https://stackoverflow.com/questions/23786388/js-error-on-gravity-forms
If we are embedding gravity form in template files and form is outside wp loop, then we need to call gravity_form_enqueue_scripts( $form_id, $is_ajax ); function to force stylesheets and scripts to load in the header.
Documentation: https://docs.gravityforms.com/gravity_form_enqueue_scripts/