Programmatically updating a node
You can try this code

&lt;?php
use Drupal\node\Entity\Node;

$node = Node::load($nid);
//set value for field
$node-&gt;body-&gt;value = 'body';
$node-&gt;body-&gt;format = 'full_html';
//field tag
$node-&gt;field_tags = [1];
//field image
$field_image = array(
    'target_id' =&gt; $fileID,
    'alt' =&gt; "My 'alt'",
    'title' =&gt; "My 'title'",
);
$node-&gt;field_image = $field_image;

//save to update node
$node-&gt;save();