title: How can i use es6 modules in node.js
body: <p>I'm trying to import express into my project using ES6 syntax, but it keeps giving me the error:</p>
  
  <pre><code>import express from "express";
  SyntaxError: Unexpected identifier
  </code></pre>
  
  <p>I have done a bit of research and found where people were saying to add:</p>
  
  <p>"type":"module"</p>
  
  <p>to my package.json file, which I have done:</p>
  
  <pre><code>...
  "description": "Shopping list to learn the MERN stack",
    "type": "module",
    "main": "server.js",
    "scripts": {
      "start": "node server.js",
      "server": "nodemon server.js"
    },
  ...
  </code></pre>
  
  <p>But I'm still getting the same issue.  I would prefer to use the import ES6 syntax rather than this syntax.</p>
  
  <pre><code>const express = require('express')
  </code></pre>