I am trying to start the M220JS course. I downloaded the file mflix-js.zip and unzipped into my working dir, im using Ubuntu 20.04. I did the following things:
- I edited the dotenv_unix by adding a unique secret key as per the course instructions,
- the MFLIX_DB_URI with my mongo srv connection string from the 'connect your application, replacing the username, password and myFirstDatabase as per the instructions in the Atlas connection window.
- I renamed dotenv_unix to .env
When I run npm start i get the following error:
import app from “./server”;
SyntaxError: Cannot use import statement outside a module
After looking on stackoverflow, I see this is because type:module needs to be added to the package.json. When I do that I get
ReferenceError: require is not defined in ES module scope, you can use import instead
Again checking stackoverflow, it suggests changing type to commonjs to fix this error, but I get the first error then. I have tried doing this with multiple versions of node, (10.20.0 and 16.13.0).
Can anyone advise how to fix this, I have just started the course and so this is very frustrating.