I'm getting this error:
(base) marco@pc01:~/webMatters/electronMatters/react-ggc$ yarn
electron .
yarn run v1.22.5
warning ../package.json: No license field
$ /home/marco/webMatters/electronMatters/react-ggc/node_modules
/.bin/electron .
App threw an error during load
/home/marco/webMatters/electronMatters/react-ggc/src/main.ts:14
import * as logdown from 'logdown';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1051:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules
cjs/loader.js:1166:10)
at Module.load (internal/modules/cjs/loader.js:981:32)
at Module._load (internal/modules/cjs/loader.js:881:14)
at Function.Module._load (electron/js2c/asar.js:769:28)
at loadApplicationPackage (/home/marco/webMatters/electronMatters
/react-ggc/node_modules/electron/dist/resources/default_app.asar
/main.js:109:16)
at Object.<anonymous> (/home/marco/webMatters/electronMatters
/react-ggc/node_modules/electron/dist/resources/default_app.asar
/main.js:155:9)
at Module._compile (internal/modules/cjs/loader.js:1145:30)
at Object.Module._extensions..js (internal/modules
/cjs/loader.js:1166:10)
A JavaScript error occurred in the main process
Uncaught Exception:
/home/marco/webMatters/electronMatters/react-ggc/src/main.ts:14
import * as logdown from 'logdown';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1051:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1166:10)
at Module.load (internal/modules/cjs/loader.js:981:32)
at Module._load (internal/modules/cjs/loader.js:881:14)
at Function.Module._load (electron/js2c/asar.js:769:28)
at loadApplicationPackage (/home/marco/webMatters/electronMatters/react-ggc/node_modules
/electron/dist/resources/default_app.asar/main.js:109:16)
at Object.<anonymous> (/home/marco/webMatters/electronMatters/react-ggc/node_modules
/electron/dist/resources/default_app.asar/main.js:155:9)
at Module._compile (internal/modules/cjs/loader.js:1145:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1166:10)
Following the suggestions found here: https://github.com/TypeStrong/ts-node/issues/1007 I've put in package.json:
"type": "module"
and this is tsconfig.json :
{
"compilerOptions": {
"skipLibCheck": true,
"strict": true,
"noImplicitAny": false,
"sourceMap": true,
"noFallthroughCasesInSwitch": true,
"lib": [
"es2015",
"es2017",
"es2019",
"dom",
"webworker"
],
"target": "es2016",
"module": "ESNext",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"jsx": "react",
"pretty": true,
"experimentalDecorators": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
},
"include": [
"src"
]
}
I already installed @types/node": "^12.0.0" and already put in /src package.json :
{ "type": "module" }
node version: v14.5.0
Ubuntu 18.04.4 Desktop
electron: 10.1.2
How to solve the problem? looking forward to your kind help