Cannot use import statement outside a module but package.json present

electron ./touchbar.js 
App threw an error during load
/home/marco/webMatters/vueMatters/GGC/src/services/electron-services/touchbar.js:1
import { app, BrowserWindow, TouchBar } from 'electron';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Module._compile (internal/modules/cjs/loader.js:895:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1004:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:738:28)
    at loadApplicationPackage (/home/marco/.nvm/versions/node/v14.3.0/lib/node_modules/electron
/dist/resources/default_app.asar/main.js:109:16)
    at Object.<anonymous> (/home/marco/.nvm/versions/node/v14.3.0/lib/node_modules/electron
/dist/resources/default_app.asar/main.js:155:9)
    at Module._compile (internal/modules/cjs/loader.js:967:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1004:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
(node:11881) Warning: require() of ES modules is not supported.
require() of /home/marco/webMatters/vueMatters/GGC/src/services/electron-services/touchbar.js   
from /home/marco/.nvm/versions/node/v14.3.0/lib/node_modules/electron/dist/resources
/default_app.asar/main.js is an ES module file as it is a .js file whose nearest parent package.json  
contains "type": "module" which defines all .js files in that package scope as ES modules. 
Instead rename touchbar.js to end in .cjs, change the requiring code to use import(), or remove 
"type": "module" from /home/marco/webMatters/vueMatters/GGC/src/services/electron-services
/package.json.
Gtk-Message: 11:13:40.797: GtkDialog mapped without a transient parent. This is discouraged.
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to open nouveau (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}
/dri:/usr/lib/dri)
failed to load driver: nouveau
MESA-LOADER: failed to open kms_swrast (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}
/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}
/dri:/usr/lib/dri)
failed to load swrast driver

But in the folder where the file touchbar.js lies, I put package.json :

ls -lah
total 16K
drwxr-xr-x 2 marco marco 4,0K giu 20 11:13 .
drwxr-xr-x 6 marco marco 4,0K giu 20 11:09 ..
-rwxr-xr-x 1 marco marco   21 giu 20 11:13 package.json
-rw-r--r-- 1 marco marco 2,3K giu 20 11:12 touchbar.js

nano package.json :

{ "type": "module" }

So… how to solve the problem?
Looking forward to your kind help.
Marco