Npm start error

having issues starting the server locally, got this error

/home/innextinit/Downloads/mflix-js/src/index.js:1
import app from “./server”;
^^^^^^
SyntaxError: Cannot use import statement outside a module

when i go into the package.json to include the “type”: “module” i get this error

file:///home/innextinit/Downloads/mflix-js/index.js:1
require("@babel/register")
^
ReferenceError: require is not defined
at file:///home/innextinit/Downloads/mflix-js/index.js:1:1

Make sure you are running from mflix-js folder. If yes, then please check which version you are using for NodeJS or npm?

Kanika

I have the same problem. It’s sad that this project don’t run out of the box. I work with node daily, so my setup is not the problem. Running from the directory the package.json is, with node 10.23.1 (tried node 14 too).

Using the code from the GitHub repo worked (GitHub - mongodb-university/mflix-js). But you have to delete package-lock.json before running npm install.