title: TypeError: Cannot read property 'setDefault' of undefined in momentjs,, moment.tz()
body: <p>I have an JS file in a npm enviornment and it and its associated package.json is given below.
  I receive the following ERROR, while running the file 'app.js'.</p>
  <blockquote>
  <p>TypeError: Cannot read property 'setDefault' of undefined</p>
  </blockquote>
  <p>I am not able to access moment.tz() as it is getting the value of undefined.</p>
  <p>app.js</p>
  <pre><code>import moment from &quot;moment&quot;;
  
  moment.tz.setDefault(moment.tz.guess());
  console.log(moment().tz());
  </code></pre>
  <p>package.json</p>
  <pre><code>  &quot;name&quot;: &quot;folder_name_here&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;type&quot;: &quot;module&quot;,
    &quot;scripts&quot;: {
      &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
    },
    &quot;author&quot;: &quot;&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;dependencies&quot;: {
      &quot;moment&quot;: &quot;^2.29.1&quot;,
      &quot;moment-timezone&quot;: &quot;^0.5.33&quot;
    }
  }
  </code></pre>