title: sqlite3 database: TypeError: Cannot read property of undefined
body: <p>I have a Node.js script that used to work, but after I switched to another VM it does not work anymore. Can anyone see what the problem is? Here is the function, db is a database:</p>
  
  <pre><code>this.start = function() {
    logger.debug('Starting up.');
    db.serialize(() =&gt; {
      db.run("DELETE FROM jobs WHERE status = 'failed'")
        .run("UPDATE jobs SET status = 'queued'", (err) =&gt; {
          if (err) {
            logger.error(err.message);
          } else {
            logger.info('done');
          }
        });
    });
  }
  </code></pre>
  
  <p>Now I get the following error: </p>
  
  <pre><code>TypeError: Cannot read property 'run' of undefined
   at Database.db.serialize ()
   at TransactionDatabase.serialize
   at module.exports.start
   at Object.&lt;anonymous&gt;
  ...
  </code></pre>
  
  <p>The error is pointing at the second ".run".</p>
  
  <p>My Node.js version is 10.4.1, sqlite3 version 3.8.2.</p>
  
  <p>What am I missing? Some module?</p>