Cannot npm start

Hi folks,

I cannot start nodejs after following the tuto
I think it’s like it is not recognize the conf .env

Here is the message

Blockquote

C:\Users\jltou\university\m220>npm start

server@1.0.0 start C:\Users\jltou\university\m220
nodemon -L ./index.js

[nodemon] 1.17.5
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node ./index.js
C:\Users\jltou\university\m220\src\index.js:1
(function (exports, require, module, __filename, __dirname) { import app from “./server”;
^^^

SyntaxError: Unexpected identifier
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at loader (C:\Users\jltou\university\m220\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\jltou\university\m220\node_modules\babel-register\lib\node.js:154:7)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)

Blockquote

I’m stuck for some days around this error

Thank’s
Jean-Luc

Hi @jean-luc_TOUZALIN_86495,

Please take a look at the following post:

Let me know if that solves your issue.

Kanika

Hi,

Well I just use winrar to unzip mflix-js.zip to a folder.
After I adapt dotenv_windows and rename to .env
How can I be sure that the file .env is used ?

regards

Write this on .bablerc
{
“presets”: [
“env”,
“stage-1”
],
“plugins”: [
“transform-runtime”
]
}

Write this on .eslintrc

{

“extends”: [“react-app”, “prettier”],
“rules”: {
“jsx-a11y/href-no-hash”: “off”,
“jsx-a11y/anchor-is-valid”: [“warn”, { “aspects”: [“invalidHref”] }]
}
}

Writethis on .prettierrc
{
“useTabs”: false,
“printWidth”: 80,
“tabWidth”: 2,
“singleQuote”: false,
“trailingComma”: “all”,
“parser”: “babylon”,
“semi”: false
}

All thee files should be written at project root.

I had the same issue as well on Windows 10. I am not sure why the initial zip extraction did not copy the files .babelrc;.eslintrc;.prettierrc, but once those files were added to the project root the application started fine.