My problem is that when I run "node index.js" I get this message:
Users/martina/JPMC-tech-task-2-PY3/index.js:1
import React from 'react';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:877:16)
at Module._compile (internal/modules/cjs/loader.js:928:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:994:10)
at Module.load (internal/modules/cjs/loader.js:813:32)
at Function.Module._load (internal/modules/cjs/loader.js:725:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1046:10)
at internal/main/run_main_module.js:17:11
this seems to say that there is a problem with the import on the first line of my index.js file, but i have no idea how to solve this problem. thank u if anyone can help!
my package.json :
{
"name": "jpmc-tech-task-2-py3",
"version": "1.0.0",
"description": "s",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start:dev": "webpack-dev-server --config webpack.config.js"
},
"repository": {
"url": "git+https://github.com/insidesherpa/JPMC-tech-task-2-PY3.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/insidesherpa/JPMC-tech-task-2-PY3/issues"
},
"homepage": "https://github.com/insidesherpa/JPMC-tech-task-2-PY3#readme",
"type": "module"
}
basically what i'm being asked to do is that while having an http server on another terminal window i'm supposed to do "npm start" on this terminal and it should open a localhost web page with some data. (it's an assignment but i don't understand much of it) however npm start is not in my package.json by default and i saw that it seems to just be supposed to throw index.js, so that's what i'm trying to do but failing