Can't render node view mode pro-grammatically
Your problem is here:

use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
use Drupal\Core\Render;
$nid = 1;
$entity_type = 'node';
$view_mode = 'teaser';
$builder = \Drupal::service('entity_type.manager')-&gt;getViewBuilder($entity_type);
$storage = \Drupal::service('entity.manager')-&gt;getStorage($entity_type);
$node = $storage-&gt;load($nid);
$build = $builder-&gt;view($node, $view_mode);
$output = \Drupal::service('renderer')-&gt;render($node);
var_dump($node);


You have dumped your code raw into a file. You cannot do that - your code is being called before Drupal has bootstrapped. You need to put your code into a function some hook that is called after Drupal has bootstrapped. I don't know what you're trying to accomplish, so I can't give any more info than that.