Import (ES6) is causing a SyntaxError

Hey! I’m not sure why I’m getting this error when my node app starts up but it seems ES6-related.

import fs from 'fs';
       ^^
SyntaxError: Unexpected identifier

In my package.json, I have "type": "module", included so I am not sure why this is happening.

Hi @metalandcoffee! If you set your version of Node in package.json to a version of Node that supports module types (I think it was introduced in 12), it should work. You can do this by adding the following to package.json:

“engines”: {
“node”: “14.x”
},

Oh, I should add - when you don’t set the engine in package.json, the app defaults to Node 10 which is why that happened. Sorry for the trouble there!